Creating a storage image
Storage images allow us to load (unfiltered) data from images bound to pipelines. But, what's more important, they also allow us to store data from shaders in the images. Such images must be created with a VK_IMAGE_USAGE_STORAGE_BIT
usage flag specified.
How to do it...
- Take the handle of a physical device and store it in a variable of type
VkPhysicalDevice
namedphysical_device
. - Select a format that will be used for a storage image. Initialize a variable of type
VkFormat
namedformat
with the selected format.
- Create a variable of type
VkFormatProperties
namedformat_properties
. - Call
vkGetPhysicalDeviceFormatProperties( physical_device, format, &format_properties )
and provide thephysical_device
variable, theformat
variable, and a pointer to theformat_properties
variable. - Check whether the selected image format is suitable for a storage image. Do that by checking whether the
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
bit of anoptimalTilingFeatures
member of theformat_properties...