How it works...

Rendering animation is performed in a loop. One frame is rendered and an image is presented, then usually the operating system messages are processed. Next, another frame is rendered and presented, and so on.

When we have only one command buffer and other resources required to prepare, render, and display a frame, we can't reuse them immediately. Semaphores cannot be used for another submission until the previous submission, in which they were used, has been finished. This situation requires us to wait for the end of the command buffer processing. But such waits are highly undesirable. The more we wait on the CPU, the more stalls we introduce to the graphics hardware and the worse performance we achieve.

To shorten the time ...

Get Vulkan Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.