Daniel Roman
Daniel Roman

Reputation: 1

Descriptor set in Vulkan using the same binding for different resource types

I have a shader that uses constant buffer, image and sampler all bound as the first slot (0). If I try to create a descriptor set layout with binding == 0 for multiple entries I get a validation error:

validation layer: Validation Error: [ VUID-VkDescriptorSetLayoutCreateInfo-binding-00279 ] | MessageID = 0xf6f49662 | vkCreateDescriptorSetLayout(): pCreateInfo->pBindings[1].binding is duplicated at pBindings[0].binding.

The Vulkan spec states:

If the perStageDescriptorSet feature is not enabled, or flags does not contain VK_DESCRIPTOR_SET_LAYOUT_CREATE_PER_STAGE_BIT_NV, then the VkDescriptorSetLayoutBinding::binding members of the elements of the pBindings array must each have different values

Is there a way to fix this without using the NV extension? (I'm working with AMD card)

Expecting to define a descriptor set layout where multiple resource types are used at the first slot.

Upvotes: 0

Views: 77

Answers (1)

solidpixel
solidpixel

Reputation: 12229

Expecting to define a descriptor set layout where multiple resource types are used at the first slot.

Aliasing the same descriptor set for multiple resource type bindings in the shader is possible, but it's not supported by default. You will need to enable sparse binding (if the target supports it).

VkPhysicalDeviceDescriptorIndexingFeatures.descriptorBindingPartiallyBound = VK_TRUE;

Upvotes: 0

Related Questions