Selecting desired usage scenarios of swapchain images
Images created with a swapchain are usually used as color attachments. This means that we want to render into them (use them as render targets). But we are not limited only to this scenario. We can use swapchain images for other purposes--we can sample from them, use them as a source of data in copy operations, or copy data into them. These are all different image usages and we can specify them during swapchain creation. But, again, we need to check whether these usages are supported.
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
. - Choose the desired image usages and store them in a variable of a bit field type
VkImageUsageFlags
nameddesired_usages
. - Create a variable of type
VkImageUsageFlags
namedimage_usage
in which a list of requested usages that are supported on...