Advertisement

Per Render Pass Resource Binding (Vulkan)

Started by July 29, 2024 02:13 PM
0 comments, last by hbr3ehreg 3 months, 3 weeks ago

Hello,
I'm trying to write resource binding related code for my Vulkan rendererr.

The idea is there are a few static descriptor set layouts, and a few descriptor sets.
Each descriptor set contains data based on how often the data needs to be updated.
Like this: https://zoo.dev/blog/vulkan-resource-binding-2023
Set0: per frame, Set1: per render pass, Set2: per material, etc…

Note: “render pass” is not vkRenderPass, it's more general, like recording G buffer, pre Z pass.

For per render pass descriptor set, since different textures needs to be bound, so I enabled Descriptor Indexing, VkdescriptorBindingFlags is VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT.

My hope was calling vkCmdBindDescriptorSets once, and just using vkUpdateDescriptorSets for different resources at different render passes.

It works(renders properly) except:
validation layer complains


My Observations:
1. I use descriptor indexing across different render passes(each render pass surrounded by vkCmdBeginRenderPass / vkCmdEndRenderPass)
2. Each cmd of these render pass share one cmdBuffer, and recorded sequentially.
3. Textures get bound for different render passes share no dependency.
4. No performance slow down

Like this:
CmdBindDescriptorSets();
BindTexture(0, texture0)
BindTexture(1, texture1)
BindTexture(2, texture2)
RenderPassA.Draw();

BindTexture(3, texture3)
RenderPassB.Draw()

Number 0, 1, 2, 3, 4 is for the dstArrayElement param of VkWriteDescriptorSet.

Any suggestions are really appreciated!

This topic is closed to new replies.

Advertisement