The Vulkan extension VK_EXT_image_compression_control may be used to verify if default compression (such as AFBC) was applied, and to request fixed-rate compression.
Swapchain images are a special case, and additionally require the VK_EXT_image_compression_control_swapchain extension.
In your application, you may use
vkEnumerateDeviceExtensionProperties
to check if the device supports the extension, and, if so, include it in
VkDeviceCreateInfo
’s ppEnabledExtensionNames
before calling
vkCreateDevice
.
In the Vulkan Samples framework, this can be handled in the sample’s constructor with this helper function:
afrc::afrc()
{
add_device_extension(VK_EXT_IMAGE_COMPRESSION_CONTROL_EXTENSION_NAME);
}
If a device supports the extension, it does not mean that it also supports fixed-rate compression of images. The extension may still be used to verify if the images use default (lossless) compression.
Before compressing a VkImage
, you need to use the extension to query if any given image, with its particular format and usage properties, supports fixed-rate compression, as shown in the next step.