Synchronizing two command buffers
We know how to prepare work and submit it to queues. We also know how to create semaphores. In this sample recipe, we will see how to use semaphores to synchronize two command buffers. More specifically, we will learn how to postpone the processing of a command buffer until the processing of another command buffer is finished.
Getting ready
In this recipe we will use the WaitSemaphoreInfo
structure introduced in the Submitting command buffers to a queue recipe. For reference, here is its definition:
struct WaitSemaphoreInfo { VkSemaphore Semaphore; VkPipelineStageFlags WaitingStage; };
How to do it...
- Take the handle of a queue to which the first batch of command buffers will be submitted. Store this handle in a variable of type
VkQueue
namedfirst_queue
. - Create semaphores that should be signaled when the processing of the first batch of command buffers is finished (refer to Creating a semaphore recipe). Store the semaphores in a variable of...