How it works...

Preparing a single frame of animation can be divided into five steps:

  1. Acquiring a swapchain image.
  2. Creating a framebuffer.
  3. Recording a command buffer.
  4. Submitting the command buffer to the queue.
  5. Presenting an image.

First, we must acquire a swapchain image into which we can render. Rendering is performed inside a render pass that defines the parameters of attachments. Specific resources used for these attachments are defined in a framebuffer.

As we want to render into a swapchain image (to display the image on screen), this image must be specified as one of the attachments defined in a framebuffer. It may seem that creating a framebuffer earlier and reusing it during the rendering is a good idea. Of course, it is a valid ...

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.