Descriptor set binding frecuency

I’m having some trouble with descriptor set binding. From what I understand, if you want to separate descriptor sets by binding frecuency you have to have different descriptor set layouts right?.

So now I have one for the camera’s descriptor set, which should be bound once, and one for each mesh’s descriptor set, which should be bound once per mesh, before calling vkCmdDrawIndexed():

layout(set = 0, binding = 0) uniform Camera {
       // ^^^ First VkDescriptorSetLayout for the camera in the VkPipelineLayout.
    mat4 view;
    mat4 projection;
} camera;

layout(set = 1, binding = 0) uniform Mesh {
       // ^^^ Second VkDescriptorSetLayout for each mesh in the VkPipelineLayout.
    mat4 model;
} mesh;


void main() {
    gl_Position = camera.projection * camera.view * mesh.model * vec4(inPosition, 1.0);
    outColor = inColor;

Now, when I bind the mesh’s descriptor set when recording the command buffers, I get this error:

Validation Error: [ VUID-vkCmdBindDescriptorSets-pDescriptorSets-00358 ] Object 0: handle = 0xfed408000000002d, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; | MessageID = 0xe1b89b63 | vkCmdBindDescriptorSets(): descriptorSet #0 being bound is not compatible with overlapping descriptorSetLayout at index 0 of VkPipelineLayout 0x30f5a50000000020[] due to: Binding 0 for VkDescriptorSetLayout 0xaa989b000000001e[] from pipeline layout is type ‘VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC’ but binding 0 for VkDescriptorSetLayout 0xbb4e7a000000001f[], which is bound, is type ‘VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER’. The Vulkan spec states: Each element of pDescriptorSets must have been allocated with a VkDescriptorSetLayout that matches (is the same as, or identically defined as) the VkDescriptorSetLayout at set n in layout, where n is the sum of firstSet and the index into pDescriptorSets.

My question is, why do they overlap if they were allocated from different descriptor set layouts?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.