Understanding synchronization primitives in Vulkan
Synchronization is key to bringing order and discipline into asynchronous system. It not only improves resource utilization, it also benefits from parallelism by reducing CPU and GPU idle time.
Vulkan offers the following four types of synchronization primitive for concurrent execution:
- Fences: Offer synchronization between the host and device
- Semaphores: Synchronize between and within queues
- Events: Between queue submissions
- Barriers: Within a command buffer between commands
In this section, we will learn about synchronization primitives and understand their API specification. The drawing object example that we implemented in this chapter makes use of semaphores to synchronize swapchain image writing. In the next chapter, we will learn to draw textures and implement fence to synchronize the host and device.
Fences
When a host submits a command in a queue, it gets scheduled for device processing. Sometimes it may require to know the status of command...