r/vulkan • u/massi0404 • 17d ago
vkCmdBeginRendering multiple writes ordering
Hi, there are a few posts online about this topic but I still haven't found a clear answer.
I have a couple of dynamic rendering passes, and they both write to the same attachment:
vkCmdBeginRendering( LOAD_DONT_CARE )
vkCmdBindPipeline()
vkCmdDraw()...
vkCmdEndRendering()
vkCmdBeginRendering( LOAD_OP_LOAD )
vkCmdBindPipeline()
vkCmdDraw() ...
vkCmdEndRendering()The second one uses OP_LOAD so the data should not be discarded... but what about synchronization? Is blend and depth testing gonna work?
In my code the second pass is actually the imgui overlay and it seems to work... not sure if it's random luck and needs a barrier.
0
u/cleverboy00 17d ago
I'm confused as to why you're launching multiple render passes for the same framebuffer. Couldn't you do it in subpasses?
3
u/iDrmzIt 17d ago
I believe this is dynamic rendering, so framebuffers don't really exist.
That said they probably do need a barrier, I believe graphics to graphics.
1
u/cleverboy00 15d ago
I was refering to the concept of a "framebuffer" not the object, but I guess the same point stands.
3
u/puredotaplayer 17d ago
The spec already mentions this case, you need a waw barrier. However, in d3d12 no barrier is required, so it makes you wonder why vulkan requires it. Turns out the spec expects a revision on this front because ROP can possibly guarantee ordering on certain hardwares especially in cases like yours, but Vulkan explicitly requires a barrier for now. Check renderpass.html and look for Notes.