Choosing a size of swapchain images
Usually, images created for a swapchain should fit into an application's window. The supported dimensions are available in the presentation surface's capabilities. But on some operating systems, the size of the images defines the final size of the window. We also should keep that in mind and check what dimensions are proper for the swapchain images.
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
VkExtent2D
namedsize_of_images
in which we will store the desired size of swapchain images. - Check whether the
currentExtent.width
member of thesurface_capabilities
variable is equal to0xFFFFFFFF
(-1
converted to an unsigned value ofuint32_t
type). If it is, it means that the size of images determines the size of the window. In this situation:- Assign the desired values...