#Dynamic rendering and input attachments

2 messages · Page 1 of 1 (latest)

untold vale
#

Vulkan 1.4
Theme: Dynamic rendering and input attachments

Hello. In my personal project i started to move from render passes and subpasses to dynamic rendering. Everything goes smoothly, until I reach moment wheren i need implement input attachments.
In my renderer i specify render graph, and then record command buffers from it. Command reocrding look something like this:
for(pass: passes)
{
// barriers for color, depth, stencil and input attachments:
vkCmdPipelineBarrier2

vkCmdBeginRendering
//render commands
vkCmdEndRendering

}

In render graph i can specify color,depth, stencil and input attachment, then for each pass which uses attachment I transfer its layouts to correct layout. But in dynamic rendering there is no way to specify input attachments, so my first idea (which i found somewhere) to transfer attachmnets to shader read only layout and use it as combined image sampler descriptor. But I do not like this solution.
So next thing I found is VK_KHR_dynamic_rendering_local_read extension which fortunetly is now in 1.4 standard, and look promising, but i do not know if I understand it correctly.

What i understand from this blog post https://www.khronos.org/blog/streamlining-subpasses is that each color, depth and stencil attachment from VkRenderingInfo can be used as input attachment, and what we need to do is to just bind descriptor with descriptor type VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT and use VK_IMAGE_LAYOUT_RENDERING_LOCAL_READ for input attachments, then add barier (like in post) before draw commands which use input attachments and we are done. Then in shaders we do not need to specify input_attachment_index for binded descriptors,:
layout(set = 0, binding = 0) uniform subpassInput InputAtt1

#

What i understanding from this is that i insert this barriers between draws in same begin/end rendering scope. But what when i want use as input attachments attachments which are used in earlier begin/end rendering scope. Do i add this barrier before next vkCmdBeginRendering or just after before start recording drawing commands?
If it works the way i described it, it will be great and simple.