alcoforado
alcoforado

Reputation: 556

Wait for vkCmdCopyBuffer using Vulkan semaphores

I have two command buffers cb1, cb2 and I am using semaphores to make sure that the execution of cb2 wait for the excecution of cb1. Both command buffers are submitted in a batch to the same queue.

cb1 has only a vkCmdCopyBuffer command in it.

Are the semaphores enough to guarantee that cb2 will only run after vkCmdCopyBuffer completes the memory transfer or should I add a barrier command in cb1 short after vkCmdCopyBuffer ?

Upvotes: 0

Views: 865

Answers (1)

Jesse Hall
Jesse Hall

Reputation: 6787

You generally don't need semaphores within a single queue, they're primarily for synchronizing across queues. If you're submitting both command buffers in the same batch (same VkSubmitInfo), in fact, you can't use semaphores since the semaphores are waiting on before any command buffers in the batch start, and signaled after all of the command buffers in the batch have completed.

For execution and memory dependencies within a queue, you typically want a pipeline barrier or SetEvent/WaitEvent pair.

Upvotes: 4

Related Questions