Creating a swapchain
A swapchain is used to display images on screen. It is an array of images which can be acquired by the application and then presented in our application's window. Each image has the same defined set of properties. When we have prepared all of these parameters, meaning that we chose a number, a size, a format, and usage scenarios for swapchain images, and also acquired and selected one of the available presentation modes, we are ready to create a swapchain.
How to do it...
- Take the handle of a created logical device object. Store it in a variable of type
VkDevice
namedlogical_device
. - Assign the handle of a created presentation surface to a variable of type
VkSurfaceKHR
namedpresentation_surface
. - Take the desired number of swapchain images assigned to a variable of type
uint32_t
namedimage_count
.
- Store the values of the selected image format and color space in a variable of type
VkSurfaceFormatKHR
namedsurface_format
. - Prepare the required image size and assign it to a variable...