Checking if processing of a submitted command buffer has finished
When we use semaphores, the application is not involved in the process of synchronizing the command buffers. It doesn't know when the processing of submitted commands has finished and when other commands start being processed. It all takes place "behind the stage", and is transparent to the application.
But, when we want to know when the processing of a given command buffer has ended, we need to use fences. This way, we can check when a submitted command buffer is fully processed by the device.
How to do it...
- Create an un-signaled fence and store it in a variable of type
VkFence
namedfence
. - Prepare a batch of command buffers, semaphores to wait on submission and semaphores to signal after the submission is fully processed. Use the prepared data when submitting command buffers to the selected queue. Use the
fence
variable during the submission (refer to Submitting command buffers to a queue recipe).
- Wait on the created fence...