Dependency chain in a render pass instance

If we create a pipeline barrier in a render pass instance where srcStage = pWaitDstStageMask of the semaphore, is a dependency chain formed? If so, can we use pipeline barrier instead of subpass dependency to wait for the swap chain image to be fetched?

“pipeline barrier in a render pass”, in other words Subpass Self-dependency does not permit making a Layout Transition. Which is the whole point of dealing with a conventional Swapchain Image. Otherwise the Semaphore Wait with pWaitDstStageMask would suffice (and already covers everything in the Batch with that Stage), and the hypothetical Pipeline Barrier inside renderpass would be superfluous.

But how can this pipeline barrier prevent layout transition before getting the image from swap chain? It seems that only subpass dependency can regulate layout transition

It cannot perform it per VUID-vkCmdPipelineBarrier-oldLayout-01181. Only Render Pass can perform Layout Transition inside Render Pass. And Layout Transition is a write access that needs to be sequenced between any previous and subsequent accesses as to prevent data hazard. Therefore you need External Subpass Dependency that puts the layout transition after Swapchain read, and before Load Op read\write.

That is, a pipeline barrier within a render pass instance and semaphore can form a dependency chain. But it cannot be used as a replacement for external subpass dependency, right?

I don’t see how it would be useful for anything else than it is primarily intended for. Either you need layout transition, and then you need external Subpass Dependency, or otherwisely properly transition it. And if you don’t need layout transition, then the Semaphore Wait can already do all the work and any kind of other barrier would be superfluous.

Whether it is chain or not feels like purely academic distinction. The Semaphore Wait would cover subsequent work regardless whether there is chain or not. Do you have an example where it would make a demonstrable difference?

In theory, there is a scope overlap, so chain should be formed. But it is kinda devious and unexpected in case it does happen to make a real world difference, so I personally wouldn’t trust it unless advertised as known cornercase e.g. via a CTS test.

1 Like

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.