Reputation: 3750
I've been following along in the (very awesome) nvpro raytracing tutorial and have a question about the way the CameraProperties uniform buffer is bound using layout(binding = 0, set = 1)
- I understand the binding = 0, but why set = 1?
The tutorial says "The set = 1
comes from the fact that it is the second descriptor set passed to pipelineLayoutCreateInfo.setPSetLayouts
", but when I look at HelloVulkan::createGraphicsPipeline()
I see the layout count is one, and this is where m_descSetLayout
(what binds the camera uniform buffer) is used. What am I missing?
The related section of the tutorial is here.
Thanks!
Upvotes: 3
Views: 1521
Reputation: 5828
See chapter 7.1:
std::vector<vk::DescriptorSetLayout> rtDescSetLayouts = {m_rtDescSetLayout, m_descSetLayout};
pipelineLayoutCreateInfo.setSetLayoutCount(static_cast<uint32_t>(rtDescSetLayouts.size()));
pipelineLayoutCreateInfo.setPSetLayouts(rtDescSetLayouts.data());
The pipeline layout contains two descriptor set layouts, m_rtDescSetLayout
for the acceleration structures at index 0 (set 0) and m_descSetLayout
for the screne descriptors in index 1 (set 1). In Vulkan the set is automatically derived from a descriptor set layout's index in the pipeline layouts create info.
Upvotes: 4