Selecting a number of swapchain images
When an application wants to render into a swapchain image, it must acquire it from the presentation engine. An application can acquire more images; we are not limited to just one image at a time. But the number of images that are available (unused by the presentation engine at a given time) depends on the specified presentation mode, the application's current situation (rendering/presenting history), and the number of images--when we create a swapchain, we must specify the (minimal) number of images that should be created.
How to do it...
- Acquire the capabilities of a presentation surface (refer to the Getting capabilities of a presentation surface recipe). Store them in a variable of type
VkSurfaceCapabilitiesKHR
namedsurface_capabilities
. - Create a variable of type
uint32_t
namednumber_of_images
. - Assign a value of
surface_capabilities.minImageCount + 1
to thenumber_of_images
variable. - Check whether the value of the
maxImageCount
member of thesurface_capabilities...