Simplifying Vulkan initialization and frame composition
Before jumping into this chapter, let's learn how to generalize Vulkan application initialization for all of our remaining demos and how to extract common parts of the frame composition code.
How to do it...
The Graphics Library Framework (GLFW) window creation and Vulkan rendering surface initialization are performed in the initVulkanApp
function. Let's take a closer look:
- A
Resolution
structure can be passed as an optional parameter:struct Resolution { uint32_t width = 0; uint32_t height = 0; }; GLFWwindow* initVulkanApp( int width, int height, Resolution* outResolution = nullptr) {
- In our examples, we always use the
glslang
compiler and the Vector-Optimized Library of Kernels (VOLK) library. If anything goes wrong with initialization, we terminate the application:glslang_initialize_process(); volkInitialize(); ...