Implementing offscreen rendering in Vulkan
Before we dive into general post-processing effects, let’s learn how to implement some foundational Vulkan code for offscreen rendering. We will use this functionality throughout the rest of the book to implement various rendering and post-processing techniques.
In this recipe, we will learn how to render directly into specific mip levels of an image and access each mip level individually. As a demonstration, we will render a textured icosahedron where each mip level of the texture is painted in a different color, allowing us to clearly see how the GPU handles mip level transitions.
Getting ready
It is recommended to review the recipe Using texture data in Vulkan from Chapter 3.
The demo app for this recipe is located in Chapter10/01_OffscreenRendering.
How to do it…
Let’s start by examining the high-level code of our example app in Chapter10/01_OffscreenRendering/src/main.cpp.
- First...