1e5c31af7Sopenharmony_ci// Copyright 2015-2021 The Khronos Group, Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[appendix] 6e5c31af7Sopenharmony_ci[[compressed_image_formats]] 7e5c31af7Sopenharmony_ci= Compressed Image Formats 8e5c31af7Sopenharmony_ci 9e5c31af7Sopenharmony_ciThe compressed texture formats used by Vulkan are described in the 10e5c31af7Sopenharmony_cispecifically identified sections of the <<data-format,Khronos Data Format 11e5c31af7Sopenharmony_ciSpecification>>, version 1.3. 12e5c31af7Sopenharmony_ci 13e5c31af7Sopenharmony_ciUnless otherwise described, the quantities encoded in these compressed 14e5c31af7Sopenharmony_ciformats are treated as normalized, unsigned values. 15e5c31af7Sopenharmony_ci 16e5c31af7Sopenharmony_ciThose formats listed as sRGB-encoded have in-memory representations of 17e5c31af7Sopenharmony_ci[eq]#R#, [eq]#G# and [eq]#B# components which are nonlinearly-encoded as 18e5c31af7Sopenharmony_ci[eq]#R'#, [eq]#G'#, and [eq]#B'#; any alpha component is unchanged. 19e5c31af7Sopenharmony_ciAs part of filtering, the nonlinear [eq]#R'#, [eq]#G'#, and [eq]#B'# values 20e5c31af7Sopenharmony_ciare converted to linear [eq]#R#, [eq]#G#, and [eq]#B# components; any alpha 21e5c31af7Sopenharmony_cicomponent is unchanged. 22e5c31af7Sopenharmony_ciThe conversion between linear and nonlinear encoding is performed as 23e5c31af7Sopenharmony_cidescribed in the "`KHR_DF_TRANSFER_SRGB`" section of the Khronos Data Format 24e5c31af7Sopenharmony_ciSpecification. 25e5c31af7Sopenharmony_ci 26e5c31af7Sopenharmony_ci<<< 27e5c31af7Sopenharmony_ci 28e5c31af7Sopenharmony_ci[[appendix-compressedtex-bc]] 29e5c31af7Sopenharmony_ci== Block-Compressed Image Formats 30e5c31af7Sopenharmony_ci 31e5c31af7Sopenharmony_ciBC1, BC2 and BC3 formats are described in "`S3TC Compressed Texture Image 32e5c31af7Sopenharmony_ciFormats`" chapter of the <<data-format,Khronos Data Format Specification>>. 33e5c31af7Sopenharmony_ciBC4 and BC5 are described in the "`RGTC Compressed Texture Image Formats`" 34e5c31af7Sopenharmony_cichapter. 35e5c31af7Sopenharmony_ciBC6H and BC7 are described in the "`BPTC Compressed Texture Image Formats`" 36e5c31af7Sopenharmony_cichapter. 37e5c31af7Sopenharmony_ci 38e5c31af7Sopenharmony_ci.Mapping of Vulkan BC formats to descriptions 39e5c31af7Sopenharmony_ci[width="90%",options="header",cols="5,4"] 40e5c31af7Sopenharmony_ci|==== 41e5c31af7Sopenharmony_ci| elink:VkFormat | <<data-format,Khronos Data Format Specification>> description 42e5c31af7Sopenharmony_ci2+^| Formats described in the "`S3TC Compressed Texture Image Formats`" chapter 43e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC1_RGB_UNORM_BLOCK |BC1 with no alpha 44e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC1_RGB_SRGB_BLOCK |BC1 with no alpha, sRGB-encoded 45e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC1_RGBA_UNORM_BLOCK|BC1 with alpha 46e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC1_RGBA_SRGB_BLOCK |BC1 with alpha, sRGB-encoded 47e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC2_UNORM_BLOCK |BC2 48e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC2_SRGB_BLOCK |BC2, sRGB-encoded 49e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC3_UNORM_BLOCK |BC3 50e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC3_SRGB_BLOCK |BC3, sRGB-encoded 51e5c31af7Sopenharmony_ci2+^| Formats described in the "`RGTC Compressed Texture Image Formats`" chapter 52e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC4_UNORM_BLOCK |BC4 unsigned 53e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC4_SNORM_BLOCK |BC4 signed 54e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC5_UNORM_BLOCK |BC5 unsigned 55e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC5_SNORM_BLOCK |BC5 signed 56e5c31af7Sopenharmony_ci2+^| Formats described in the "`BPTC Compressed Texture Image Formats`" chapter 57e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC6H_UFLOAT_BLOCK |BC6H (unsigned version) 58e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC6H_SFLOAT_BLOCK |BC6H (signed version) 59e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC7_UNORM_BLOCK |BC7 60e5c31af7Sopenharmony_ci| ename:VK_FORMAT_BC7_SRGB_BLOCK |BC7, sRGB-encoded 61e5c31af7Sopenharmony_ci|==== 62e5c31af7Sopenharmony_ci 63e5c31af7Sopenharmony_ci<<< 64e5c31af7Sopenharmony_ci 65e5c31af7Sopenharmony_ci[[appendix-compressedtex-etc2]] 66e5c31af7Sopenharmony_ci== ETC Compressed Image Formats 67e5c31af7Sopenharmony_ci 68e5c31af7Sopenharmony_ciThe following formats are described in the "`ETC2 Compressed Texture Image 69e5c31af7Sopenharmony_ciFormats`" chapter of the <<data-format,Khronos Data Format Specification>>. 70e5c31af7Sopenharmony_ci 71e5c31af7Sopenharmony_ci.Mapping of Vulkan ETC formats to descriptions 72e5c31af7Sopenharmony_ci[options="header",cols="1,1"] 73e5c31af7Sopenharmony_ci|==== 74e5c31af7Sopenharmony_ci| elink:VkFormat | <<data-format,Khronos Data Format Specification>> description 75e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK |RGB ETC2 76e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK |RGB ETC2 with sRGB encoding 77e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK |RGB ETC2 with punch-through alpha 78e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK |RGB ETC2 with punch-through alpha and sRGB 79e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK |RGBA ETC2 80e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK |RGBA ETC2 with sRGB encoding 81e5c31af7Sopenharmony_ci| ename:VK_FORMAT_EAC_R11_UNORM_BLOCK |Unsigned R11 EAC 82e5c31af7Sopenharmony_ci| ename:VK_FORMAT_EAC_R11_SNORM_BLOCK |Signed R11 EAC 83e5c31af7Sopenharmony_ci| ename:VK_FORMAT_EAC_R11G11_UNORM_BLOCK |Unsigned RG11 EAC 84e5c31af7Sopenharmony_ci| ename:VK_FORMAT_EAC_R11G11_SNORM_BLOCK |Signed RG11 EAC 85e5c31af7Sopenharmony_ci|==== 86e5c31af7Sopenharmony_ci 87e5c31af7Sopenharmony_ci<<< 88e5c31af7Sopenharmony_ci 89e5c31af7Sopenharmony_ci[[appendix-compressedtex-astc]] 90e5c31af7Sopenharmony_ci== ASTC Compressed Image Formats 91e5c31af7Sopenharmony_ci 92e5c31af7Sopenharmony_ciASTC formats are described in the "`ASTC Compressed Texture Image Formats`" 93e5c31af7Sopenharmony_cichapter of the <<data-format,Khronos Data Format Specification>>. 94e5c31af7Sopenharmony_ci 95e5c31af7Sopenharmony_ci.Mapping of Vulkan ASTC formats to descriptions 96e5c31af7Sopenharmony_ci[width="90%",options="header",cols="55%,20%,25%"] 97e5c31af7Sopenharmony_ci|==== 98e5c31af7Sopenharmony_ci| elink:VkFormat ^| Compressed texel block dimensions ^| Requested mode 99e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_4x4_UNORM_BLOCK ^|[eq]#4 {times} 4# ^|Linear LDR 100e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_4x4_SRGB_BLOCK ^|[eq]#4 {times} 4# ^|sRGB 101e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_5x4_UNORM_BLOCK ^|[eq]#5 {times} 4# ^|Linear LDR 102e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_5x4_SRGB_BLOCK ^|[eq]#5 {times} 4# ^|sRGB 103e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_5x5_UNORM_BLOCK ^|[eq]#5 {times} 5# ^|Linear LDR 104e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_5x5_SRGB_BLOCK ^|[eq]#5 {times} 5# ^|sRGB 105e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_6x5_UNORM_BLOCK ^|[eq]#6 {times} 5# ^|Linear LDR 106e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_6x5_SRGB_BLOCK ^|[eq]#6 {times} 5# ^|sRGB 107e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_6x6_UNORM_BLOCK ^|[eq]#6 {times} 6# ^|Linear LDR 108e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_6x6_SRGB_BLOCK ^|[eq]#6 {times} 6# ^|sRGB 109e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_8x5_UNORM_BLOCK ^|[eq]#8 {times} 5# ^|Linear LDR 110e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_8x5_SRGB_BLOCK ^|[eq]#8 {times} 5# ^|sRGB 111e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_8x6_UNORM_BLOCK ^|[eq]#8 {times} 6# ^|Linear LDR 112e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_8x6_SRGB_BLOCK ^|[eq]#8 {times} 6# ^|sRGB 113e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_8x8_UNORM_BLOCK ^|[eq]#8 {times} 8# ^|Linear LDR 114e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_8x8_SRGB_BLOCK ^|[eq]#8 {times} 8# ^|sRGB 115e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x5_UNORM_BLOCK ^|[eq]#10 {times} 5# ^|Linear LDR 116e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x5_SRGB_BLOCK ^|[eq]#10 {times} 5# ^|sRGB 117e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x6_UNORM_BLOCK ^|[eq]#10 {times} 6# ^|Linear LDR 118e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x6_SRGB_BLOCK ^|[eq]#10 {times} 6# ^|sRGB 119e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x8_UNORM_BLOCK ^|[eq]#10 {times} 8# ^|Linear LDR 120e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x8_SRGB_BLOCK ^|[eq]#10 {times} 8# ^|sRGB 121e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x10_UNORM_BLOCK ^|[eq]#10 {times} 10# ^|Linear LDR 122e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x10_SRGB_BLOCK ^|[eq]#10 {times} 10# ^|sRGB 123e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_12x10_UNORM_BLOCK ^|[eq]#12 {times} 10# ^|Linear LDR 124e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_12x10_SRGB_BLOCK ^|[eq]#12 {times} 10# ^|sRGB 125e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_12x12_UNORM_BLOCK ^|[eq]#12 {times} 12# ^|Linear LDR 126e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_12x12_SRGB_BLOCK ^|[eq]#12 {times} 12# ^|sRGB 127e5c31af7Sopenharmony_ciifdef::VK_EXT_texture_compression_astc_hdr[] 128e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ^|[eq]#4 {times} 4# ^|HDR 129e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT ^|[eq]#5 {times} 4# ^|HDR 130e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT ^|[eq]#5 {times} 5# ^|HDR 131e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT ^|[eq]#6 {times} 5# ^|HDR 132e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT ^|[eq]#6 {times} 6# ^|HDR 133e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT ^|[eq]#8 {times} 5# ^|HDR 134e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT ^|[eq]#8 {times} 6# ^|HDR 135e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT ^|[eq]#8 {times} 8# ^|HDR 136e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT ^|[eq]#10 {times} 5# ^|HDR 137e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT ^|[eq]#10 {times} 6# ^|HDR 138e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT ^|[eq]#10 {times} 8# ^|HDR 139e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT ^|[eq]#10 {times} 10# ^|HDR 140e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT ^|[eq]#12 {times} 10# ^|HDR 141e5c31af7Sopenharmony_ci| ename:VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT ^|[eq]#12 {times} 12# ^|HDR 142e5c31af7Sopenharmony_ciendif::VK_EXT_texture_compression_astc_hdr[] 143e5c31af7Sopenharmony_ci|==== 144e5c31af7Sopenharmony_ci 145e5c31af7Sopenharmony_ciifndef::VK_EXT_texture_compression_astc_hdr[] 146e5c31af7Sopenharmony_ciASTC textures containing any HDR blocks should: not be passed into the API 147e5c31af7Sopenharmony_ciusing an sRGB or UNORM texture format. 148e5c31af7Sopenharmony_ciendif::VK_EXT_texture_compression_astc_hdr[] 149e5c31af7Sopenharmony_ciifdef::VK_EXT_texture_compression_astc_hdr[] 150e5c31af7Sopenharmony_ciASTC textures containing HDR block encodings should: be passed to the API 151e5c31af7Sopenharmony_ciusing an ASTC SFLOAT texture format. 152e5c31af7Sopenharmony_ciendif::VK_EXT_texture_compression_astc_hdr[] 153e5c31af7Sopenharmony_ci 154e5c31af7Sopenharmony_ci[NOTE] 155e5c31af7Sopenharmony_ci.Note 156e5c31af7Sopenharmony_ci==== 157e5c31af7Sopenharmony_ciAn HDR block in a texture passed using a LDR UNORM format will return the 158e5c31af7Sopenharmony_ciappropriate ASTC error color if the implementation supports only the ASTC 159e5c31af7Sopenharmony_ciLDR profile, but may result in either the error color or a decompressed HDR 160e5c31af7Sopenharmony_cicolor if the implementation supports HDR decoding. 161e5c31af7Sopenharmony_ci==== 162e5c31af7Sopenharmony_ci 163e5c31af7Sopenharmony_ciifdef::VK_EXT_astc_decode_mode[] 164e5c31af7Sopenharmony_ci 165e5c31af7Sopenharmony_ci=== ASTC decode mode 166e5c31af7Sopenharmony_ci 167e5c31af7Sopenharmony_ciIf the `VK_EXT_astc_decode_mode` extension is enabled, the decode mode is 168e5c31af7Sopenharmony_cidetermined as follows: 169e5c31af7Sopenharmony_ci 170e5c31af7Sopenharmony_ci.Mapping of Vulkan ASTC decoding format to ASTC decoding modes 171e5c31af7Sopenharmony_ci[width="75%",options="header",cols="75%,25%"] 172e5c31af7Sopenharmony_ci|==== 173e5c31af7Sopenharmony_ci| elink:VkFormat ^| Decoding mode 174e5c31af7Sopenharmony_ci| ename:VK_FORMAT_R16G16B16A16_SFLOAT ^| decode_float16 175e5c31af7Sopenharmony_ci| ename:VK_FORMAT_R8G8B8A8_UNORM ^| decode_unorm8 176e5c31af7Sopenharmony_ci| ename:VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 ^| decode_rgb9e5 177e5c31af7Sopenharmony_ci|==== 178e5c31af7Sopenharmony_ci 179e5c31af7Sopenharmony_ciOtherwise, the ASTC decode mode is decode_float16. 180e5c31af7Sopenharmony_ci 181e5c31af7Sopenharmony_ciNote that an implementation may: use HDR mode when linear LDR mode is 182e5c31af7Sopenharmony_cirequested unless the decode mode is decode_unorm8. 183e5c31af7Sopenharmony_ciendif::VK_EXT_astc_decode_mode[] 184e5c31af7Sopenharmony_ciifndef::VK_EXT_astc_decode_mode[] 185e5c31af7Sopenharmony_ciThe ASTC decode mode is decode_float16. 186e5c31af7Sopenharmony_ci 187e5c31af7Sopenharmony_ciNote that an implementation may: use HDR mode when linear LDR mode is 188e5c31af7Sopenharmony_cirequested. 189e5c31af7Sopenharmony_ciendif::VK_EXT_astc_decode_mode[] 190e5c31af7Sopenharmony_ci 191e5c31af7Sopenharmony_ciifdef::VK_IMG_format_pvrtc[] 192e5c31af7Sopenharmony_ci<<< 193e5c31af7Sopenharmony_ci 194e5c31af7Sopenharmony_ci[[appendix-compressedtex-pvrtc]] 195e5c31af7Sopenharmony_ci== PVRTC Compressed Image Formats 196e5c31af7Sopenharmony_ci 197e5c31af7Sopenharmony_ciPVRTC formats are described in the "`PVRTC Compressed Texture Image 198e5c31af7Sopenharmony_ciFormats`" chapter of the <<data-format,Khronos Data Format Specification>>. 199e5c31af7Sopenharmony_ci 200e5c31af7Sopenharmony_ci.Mapping of Vulkan PVRTC formats to descriptions 201e5c31af7Sopenharmony_ci[width="75%",options="header",cols="63%,15%,22%"] 202e5c31af7Sopenharmony_ci|==== 203e5c31af7Sopenharmony_ci| elink:VkFormat ^| Compressed texel block dimensions ^| sRGB-encoded 204e5c31af7Sopenharmony_ci| ename:VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG ^|[eq]#8 {times} 4# ^|No 205e5c31af7Sopenharmony_ci| ename:VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG ^|[eq]#4 {times} 4# ^|No 206e5c31af7Sopenharmony_ci| ename:VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG ^|[eq]#8 {times} 4# ^|No 207e5c31af7Sopenharmony_ci| ename:VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG ^|[eq]#4 {times} 4# ^|No 208e5c31af7Sopenharmony_ci| ename:VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG ^|[eq]#8 {times} 4# ^|Yes 209e5c31af7Sopenharmony_ci| ename:VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG ^|[eq]#4 {times} 4# ^|Yes 210e5c31af7Sopenharmony_ci| ename:VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG ^|[eq]#8 {times} 4# ^|Yes 211e5c31af7Sopenharmony_ci| ename:VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG ^|[eq]#4 {times} 4# ^|Yes 212e5c31af7Sopenharmony_ci|==== 213e5c31af7Sopenharmony_ciendif::VK_IMG_format_pvrtc[] 214