Using ASTC with graphics APIs
ASTC support is split into a number of feature profiles that are supported by OpenGL ES, OpenGL, and Vulkan, either as part of the core specifications or as extensions.
The ASTC feature profiles are as follows:
- 2D for LDR images
- 2D and sliced 3D for LDR images
- 2D and sliced 3D for LDR and HDR images
- 2D, sliced 3D, and volumetric 3D for LDR and HDR images
The 2D LDR profile is mandatory in OpenGL ES 3.2, and a standardized optional feature for Vulkan. This means that the 2D LDR profile is widely supported on contemporary mobile devices. The 2D HDR profile is not mandatory, but is widely supported.
Khronos OpenGL ES support and extensions
The LDR profile of ASTC is part of the core API for OpenGL ES 3.2. Support for earlier API versions and for the other format features is provided via a number official Khronos extensions:
- KHR_texture_compression_astc_ldr: 2D for LDR images
- KHR_texture_compression_astc_sliced_3d: 2D and sliced 3D for LDR images
- KHR_texture_compression_astc_hdr: 2D and sliced 3D for LDR and HDR images
There is also an extension that provides the full feature set implied by supporting all three KHR extensions, with the addition of the volumetric 3D texture support. This extension provides the 3D block sizes, such as 4x4x4, allowing the compressor to exploit coherency across planes in the image to improve quality or reduce bitrate:
- OES_texture_compression_astc: 2D + 3D, LDR + HDR support
Note: There is a distinction between sliced 3D, where each slice can be compressed independently, and 3D formats like 4x4x4. OES_texture_compression_astc is the only extension that brings in the 3D formats, and is a superset of the KHR extensions.
Decode mode extensions
ASTC decompresses texels into fp16 intermediate values, except for sRGB which always decompresses into 8-bit UNORM intermediates. For many use cases, this gives more dynamic range and precision than required, and can cause a reduction in texturing efficiency due to the larger data size.
The following extensions, supported on recent mobile GPUs, allow applications to reduce the intermediate precision to either UNORM8 or RGB9e5:
- OES_texture_compression_astc_decode_mode: Allow UNORM8 intermediates.
- OES_texture_compression_astc_decode_mode_rgb9e5: Allow RGB9e5 intermediates.
UNORM8 is recommended for LDR textures, and RGB9e5 is recommended for HDR textures.
For more information about using the ASTC decode mode extension to select decoding precision when decoding ASTC image blocks, see OpenGL ES SDK for Android: ASTC low precision tutorial.
Vulkan support and extensions
The 2D LDR profile of ASTC is a core feature in Vulkan, but supporting the formatit is optional. Platform support can be queried at runtime by testing the
textureCompressionASTC_LDR physical device feature.
The HDR profile is provided by the following extension:
Decode mode extension
As with OpenGL ES, by default Vulkan implementations are required to decompress non-sRGB ASTC data to 16-bit floating point values. However, you can change this behavior and choose lower precision using the Vulkan decode mode extension, which covers both LDR and HDR formats: