The process of drawing is actually asynchronous, meaning that the GPU might have to wait until the CPU has finished its current job. For example, using the constant buffer, we send instructions to the GPU to update each frame of the model view projection matrix. Now, if the GPU doesn't wait for the CPU to get the uniform buffer for the current frame, then the object would not be rendered correctly.
To make sure that the GPU only executes when the CPU has done its work, we need to synchronize the CPU and GPU. This can be done using two types synchronization objects:
- The first is fences. Fences are synchronization objects that synchronize CPU and GPU operations.
- We have a second kind of synchronization object, called semaphores. Semaphore objects synchronize GPU queues. In the current scene of one triangle that we are rendering, the graphics queue...