Selecting a transformation of swapchain images
On some (especially mobile) devices, images can be viewed from different orientations. Sometimes we would like to be able to specify how an image should be oriented when it is displayed on screen. In Vulkan, we have such a possibility. When creating a swapchain, we need to specify the transformation which should be applied to an image before it is presented.
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
. - Store the desired transformations in a bit field variable of type
VkSurfaceTransformFlagBitsKHR
nameddesired_transform
. - Create a variable of type
VkSurfaceTransformFlagBitsKHR
namedsurface_transform
in which we will store the supported transformation. - Check whether all bits set in the
desired_transform
variable are also set in thesupportedTransforms
member of the presentation...