alcoforado
alcoforado

Reputation: 556

What is the pipeline a vkCmdPipelineBarrier applies to?

vkCmdPipelineBarrier doesn't get any vkPipeline as parameter. So I am wondering which pipeline a vkCmdPipelineBarrier applies to.

Is the one specified in a vkCmdBindPipeline command called earlier in the command buffer ? What if no pipeline was specified in the command buffer yet ?

Upvotes: 1

Views: 2385

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 474366

It doesn't apply to any particular pipeline object; it applies to pipeline stages which execute action commands. Pipeline objects cause action commands (rendering, etc) to generate pipeline stage commands, but this is at best an indirect association.

Barriers are synchronization commands; as such, they have a source scope and a destination scope, between which the barrier apples. For vkCmdPipelineBarrier, the source scope is (usually) all commands given to the queue before the barrier call. These commands may be in the current command buffer or a previously submitted CB within the same VkSubmitInfo batch, or a submitted CB in a previous vkQueueSubmit call.

The destination scope is (usually) all commands given to the queue after the barrier call. Again, these may be commands in the same command buffer, in subsequently submitted CBs within the same batch, or in CBs submitted in subsequent calls to vkQueueSubmit.

For subpass self-dependency barriers, the source scope is all previously submitted commands within the current subpass (and therefore, by the transitive property, all commands on which the current subpass depends), and the destination scope is all subsequently submitted commands within the same subpass (and therefore, by the transitive property, all commands that have dependencies on the current subpass).

Upvotes: 5

Related Questions