I have the following uniform in a shader pipeline:
layout (set = 1, binding = 0) uniform window_uniform_data_uniform {};
Now I want to bind this set, so I do:
vkCmdBindDescriptorSets(cmd_buffer->vk_buffer_handle, VkPipelineBindPoint::VK_PIPELINE_BIND_POINT_GRAPHICS,
PipelineLayouts::GUI,
1, // THE UNIFORM BUFFER IS SET 1
1,
&DescriptorSets::GUI, 0, nullptr);
When I call that function I get the validation error:
Vulkan validation layer callback: Validation Error: [ VUID-VkPipelineLayoutCreateInfo-pSetLayouts-parameter ] Object 0: handle = 0x1acf6211460, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0xb3f957d3 | Invalid VkDescriptorSetLayout Object 0x0. The Vulkan spec states: If setLayoutCount is not 0, pSetLayouts must be a valid pointer to an array of setLayoutCount valid VkDescriptorSetLayout handles
The reason I think this is happening is because in the pipeline layout description I say that there is one set layout count:
pipelineLayoutInfo.setLayoutCount = 1;
pipelineLayoutInfo.pSetLayouts = &DescriptorSetLayouts::GUI;
Which makes sense to me because in the shader I have only set = 1, and no 0. However what I think is happening is in the vkCmdBindDescriptorSets I pass (firstSet (1), descriptorSetCount(1) ) because I only want to update set 1. Vulkan probably looks up element/position 1 of the pipeline layouts and sees that it's empty or has invalid arguments. Is this correct?
If this is the case, does this mean that if I have a description in a shader that's set = 11 that the pipeline needs to be created with 10 dummy layouts, even if I never update them?