summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/morton.cpp22
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp13
-rw-r--r--src/video_core/surface.cpp33
-rw-r--r--src/video_core/surface.h222
4 files changed, 211 insertions, 79 deletions
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp
index ab71870ab..fe5f08ace 100644
--- a/src/video_core/morton.cpp
+++ b/src/video_core/morton.cpp
@@ -93,6 +93,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
93 MortonCopy<true, PixelFormat::DXT23_SRGB>, 93 MortonCopy<true, PixelFormat::DXT23_SRGB>,
94 MortonCopy<true, PixelFormat::DXT45_SRGB>, 94 MortonCopy<true, PixelFormat::DXT45_SRGB>,
95 MortonCopy<true, PixelFormat::BC7U_SRGB>, 95 MortonCopy<true, PixelFormat::BC7U_SRGB>,
96 MortonCopy<true, PixelFormat::R4G4B4A4U>,
96 MortonCopy<true, PixelFormat::ASTC_2D_4X4_SRGB>, 97 MortonCopy<true, PixelFormat::ASTC_2D_4X4_SRGB>,
97 MortonCopy<true, PixelFormat::ASTC_2D_8X8_SRGB>, 98 MortonCopy<true, PixelFormat::ASTC_2D_8X8_SRGB>,
98 MortonCopy<true, PixelFormat::ASTC_2D_8X5_SRGB>, 99 MortonCopy<true, PixelFormat::ASTC_2D_8X5_SRGB>,
@@ -101,6 +102,16 @@ static constexpr ConversionArray morton_to_linear_fns = {
101 MortonCopy<true, PixelFormat::ASTC_2D_5X5_SRGB>, 102 MortonCopy<true, PixelFormat::ASTC_2D_5X5_SRGB>,
102 MortonCopy<true, PixelFormat::ASTC_2D_10X8>, 103 MortonCopy<true, PixelFormat::ASTC_2D_10X8>,
103 MortonCopy<true, PixelFormat::ASTC_2D_10X8_SRGB>, 104 MortonCopy<true, PixelFormat::ASTC_2D_10X8_SRGB>,
105 MortonCopy<true, PixelFormat::ASTC_2D_6X6>,
106 MortonCopy<true, PixelFormat::ASTC_2D_6X6_SRGB>,
107 MortonCopy<true, PixelFormat::ASTC_2D_10X10>,
108 MortonCopy<true, PixelFormat::ASTC_2D_10X10_SRGB>,
109 MortonCopy<true, PixelFormat::ASTC_2D_12X12>,
110 MortonCopy<true, PixelFormat::ASTC_2D_12X12_SRGB>,
111 MortonCopy<true, PixelFormat::ASTC_2D_8X6>,
112 MortonCopy<true, PixelFormat::ASTC_2D_8X6_SRGB>,
113 MortonCopy<true, PixelFormat::ASTC_2D_6X5>,
114 MortonCopy<true, PixelFormat::ASTC_2D_6X5_SRGB>,
104 MortonCopy<true, PixelFormat::Z32F>, 115 MortonCopy<true, PixelFormat::Z32F>,
105 MortonCopy<true, PixelFormat::Z16>, 116 MortonCopy<true, PixelFormat::Z16>,
106 MortonCopy<true, PixelFormat::Z24S8>, 117 MortonCopy<true, PixelFormat::Z24S8>,
@@ -162,6 +173,17 @@ static constexpr ConversionArray linear_to_morton_fns = {
162 MortonCopy<false, PixelFormat::DXT23_SRGB>, 173 MortonCopy<false, PixelFormat::DXT23_SRGB>,
163 MortonCopy<false, PixelFormat::DXT45_SRGB>, 174 MortonCopy<false, PixelFormat::DXT45_SRGB>,
164 MortonCopy<false, PixelFormat::BC7U_SRGB>, 175 MortonCopy<false, PixelFormat::BC7U_SRGB>,
176 MortonCopy<false, PixelFormat::R4G4B4A4U>,
177 nullptr,
178 nullptr,
179 nullptr,
180 nullptr,
181 nullptr,
182 nullptr,
183 nullptr,
184 nullptr,
185 nullptr,
186 nullptr,
165 nullptr, 187 nullptr,
166 nullptr, 188 nullptr,
167 nullptr, 189 nullptr,
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 173b76c4e..2f9bfd7e4 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -111,7 +111,8 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
111 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 111 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
112 true}, // DXT45_SRGB 112 true}, // DXT45_SRGB
113 {GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 113 {GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
114 true}, // BC7U_SRGB 114 true}, // BC7U_SRGB
115 {GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, ComponentType::UNorm, false}, // R4G4B4A4U
115 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4_SRGB 116 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4_SRGB
116 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X8_SRGB 117 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X8_SRGB
117 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X5_SRGB 118 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X5_SRGB
@@ -120,6 +121,16 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
120 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X5_SRGB 121 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X5_SRGB
121 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X8 122 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X8
122 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X8_SRGB 123 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X8_SRGB
124 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X6
125 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X6_SRGB
126 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X10
127 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X10_SRGB
128 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_12X12
129 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_12X12_SRGB
130 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X6
131 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X6_SRGB
132 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X5
133 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X5_SRGB
123 134
124 // Depth formats 135 // Depth formats
125 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F 136 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index ef6b3592e..9a3c05288 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -212,6 +212,14 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
212 break; 212 break;
213 } 213 }
214 break; 214 break;
215 case Tegra::Texture::TextureFormat::A4B4G4R4:
216 switch (component_type) {
217 case Tegra::Texture::ComponentType::UNORM:
218 return PixelFormat::R4G4B4A4U;
219 default:
220 break;
221 }
222 break;
215 case Tegra::Texture::TextureFormat::R8: 223 case Tegra::Texture::TextureFormat::R8:
216 switch (component_type) { 224 switch (component_type) {
217 case Tegra::Texture::ComponentType::UNORM: 225 case Tegra::Texture::ComponentType::UNORM:
@@ -351,6 +359,16 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
351 return is_srgb ? PixelFormat::ASTC_2D_8X5_SRGB : PixelFormat::ASTC_2D_8X5; 359 return is_srgb ? PixelFormat::ASTC_2D_8X5_SRGB : PixelFormat::ASTC_2D_8X5;
352 case Tegra::Texture::TextureFormat::ASTC_2D_10X8: 360 case Tegra::Texture::TextureFormat::ASTC_2D_10X8:
353 return is_srgb ? PixelFormat::ASTC_2D_10X8_SRGB : PixelFormat::ASTC_2D_10X8; 361 return is_srgb ? PixelFormat::ASTC_2D_10X8_SRGB : PixelFormat::ASTC_2D_10X8;
362 case Tegra::Texture::TextureFormat::ASTC_2D_6X6:
363 return is_srgb ? PixelFormat::ASTC_2D_6X6_SRGB : PixelFormat::ASTC_2D_6X6;
364 case Tegra::Texture::TextureFormat::ASTC_2D_10X10:
365 return is_srgb ? PixelFormat::ASTC_2D_10X10_SRGB : PixelFormat::ASTC_2D_10X10;
366 case Tegra::Texture::TextureFormat::ASTC_2D_12X12:
367 return is_srgb ? PixelFormat::ASTC_2D_12X12_SRGB : PixelFormat::ASTC_2D_12X12;
368 case Tegra::Texture::TextureFormat::ASTC_2D_8X6:
369 return is_srgb ? PixelFormat::ASTC_2D_8X6_SRGB : PixelFormat::ASTC_2D_8X6;
370 case Tegra::Texture::TextureFormat::ASTC_2D_6X5:
371 return is_srgb ? PixelFormat::ASTC_2D_6X5_SRGB : PixelFormat::ASTC_2D_6X5;
354 case Tegra::Texture::TextureFormat::R16_G16: 372 case Tegra::Texture::TextureFormat::R16_G16:
355 switch (component_type) { 373 switch (component_type) {
356 case Tegra::Texture::ComponentType::FLOAT: 374 case Tegra::Texture::ComponentType::FLOAT:
@@ -511,6 +529,16 @@ bool IsPixelFormatASTC(PixelFormat format) {
511 case PixelFormat::ASTC_2D_8X5_SRGB: 529 case PixelFormat::ASTC_2D_8X5_SRGB:
512 case PixelFormat::ASTC_2D_10X8: 530 case PixelFormat::ASTC_2D_10X8:
513 case PixelFormat::ASTC_2D_10X8_SRGB: 531 case PixelFormat::ASTC_2D_10X8_SRGB:
532 case PixelFormat::ASTC_2D_6X6:
533 case PixelFormat::ASTC_2D_6X6_SRGB:
534 case PixelFormat::ASTC_2D_10X10:
535 case PixelFormat::ASTC_2D_10X10_SRGB:
536 case PixelFormat::ASTC_2D_12X12:
537 case PixelFormat::ASTC_2D_12X12_SRGB:
538 case PixelFormat::ASTC_2D_8X6:
539 case PixelFormat::ASTC_2D_8X6_SRGB:
540 case PixelFormat::ASTC_2D_6X5:
541 case PixelFormat::ASTC_2D_6X5_SRGB:
514 return true; 542 return true;
515 default: 543 default:
516 return false; 544 return false;
@@ -531,6 +559,11 @@ bool IsPixelFormatSRGB(PixelFormat format) {
531 case PixelFormat::ASTC_2D_5X4_SRGB: 559 case PixelFormat::ASTC_2D_5X4_SRGB:
532 case PixelFormat::ASTC_2D_5X5_SRGB: 560 case PixelFormat::ASTC_2D_5X5_SRGB:
533 case PixelFormat::ASTC_2D_10X8_SRGB: 561 case PixelFormat::ASTC_2D_10X8_SRGB:
562 case PixelFormat::ASTC_2D_6X6_SRGB:
563 case PixelFormat::ASTC_2D_10X10_SRGB:
564 case PixelFormat::ASTC_2D_12X12_SRGB:
565 case PixelFormat::ASTC_2D_8X6_SRGB:
566 case PixelFormat::ASTC_2D_6X5_SRGB:
534 return true; 567 return true;
535 default: 568 default:
536 return false; 569 return false;
diff --git a/src/video_core/surface.h b/src/video_core/surface.h
index 1e1c432a5..97668f802 100644
--- a/src/video_core/surface.h
+++ b/src/video_core/surface.h
@@ -67,27 +67,38 @@ enum class PixelFormat {
67 DXT23_SRGB = 49, 67 DXT23_SRGB = 49,
68 DXT45_SRGB = 50, 68 DXT45_SRGB = 50,
69 BC7U_SRGB = 51, 69 BC7U_SRGB = 51,
70 ASTC_2D_4X4_SRGB = 52, 70 R4G4B4A4U = 52,
71 ASTC_2D_8X8_SRGB = 53, 71 ASTC_2D_4X4_SRGB = 53,
72 ASTC_2D_8X5_SRGB = 54, 72 ASTC_2D_8X8_SRGB = 54,
73 ASTC_2D_5X4_SRGB = 55, 73 ASTC_2D_8X5_SRGB = 55,
74 ASTC_2D_5X5 = 56, 74 ASTC_2D_5X4_SRGB = 56,
75 ASTC_2D_5X5_SRGB = 57, 75 ASTC_2D_5X5 = 57,
76 ASTC_2D_10X8 = 58, 76 ASTC_2D_5X5_SRGB = 58,
77 ASTC_2D_10X8_SRGB = 59, 77 ASTC_2D_10X8 = 59,
78 ASTC_2D_10X8_SRGB = 60,
79 ASTC_2D_6X6 = 61,
80 ASTC_2D_6X6_SRGB = 62,
81 ASTC_2D_10X10 = 63,
82 ASTC_2D_10X10_SRGB = 64,
83 ASTC_2D_12X12 = 65,
84 ASTC_2D_12X12_SRGB = 66,
85 ASTC_2D_8X6 = 67,
86 ASTC_2D_8X6_SRGB = 68,
87 ASTC_2D_6X5 = 69,
88 ASTC_2D_6X5_SRGB = 70,
78 89
79 MaxColorFormat, 90 MaxColorFormat,
80 91
81 // Depth formats 92 // Depth formats
82 Z32F = 60, 93 Z32F = 71,
83 Z16 = 61, 94 Z16 = 72,
84 95
85 MaxDepthFormat, 96 MaxDepthFormat,
86 97
87 // DepthStencil formats 98 // DepthStencil formats
88 Z24S8 = 62, 99 Z24S8 = 73,
89 S8Z24 = 63, 100 S8Z24 = 74,
90 Z32FS8 = 64, 101 Z32FS8 = 75,
91 102
92 MaxDepthStencilFormat, 103 MaxDepthStencilFormat,
93 104
@@ -177,6 +188,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
177 2, // DXT23_SRGB 188 2, // DXT23_SRGB
178 2, // DXT45_SRGB 189 2, // DXT45_SRGB
179 2, // BC7U_SRGB 190 2, // BC7U_SRGB
191 0, // R4G4B4A4U
180 2, // ASTC_2D_4X4_SRGB 192 2, // ASTC_2D_4X4_SRGB
181 2, // ASTC_2D_8X8_SRGB 193 2, // ASTC_2D_8X8_SRGB
182 2, // ASTC_2D_8X5_SRGB 194 2, // ASTC_2D_8X5_SRGB
@@ -185,6 +197,16 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
185 2, // ASTC_2D_5X5_SRGB 197 2, // ASTC_2D_5X5_SRGB
186 2, // ASTC_2D_10X8 198 2, // ASTC_2D_10X8
187 2, // ASTC_2D_10X8_SRGB 199 2, // ASTC_2D_10X8_SRGB
200 2, // ASTC_2D_6X6
201 2, // ASTC_2D_6X6_SRGB
202 2, // ASTC_2D_10X10
203 2, // ASTC_2D_10X10_SRGB
204 2, // ASTC_2D_12X12
205 2, // ASTC_2D_12X12_SRGB
206 2, // ASTC_2D_8X6
207 2, // ASTC_2D_8X6_SRGB
208 2, // ASTC_2D_6X5
209 2, // ASTC_2D_6X5_SRGB
188 0, // Z32F 210 0, // Z32F
189 0, // Z16 211 0, // Z16
190 0, // Z24S8 212 0, // Z24S8
@@ -261,6 +283,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
261 4, // DXT23_SRGB 283 4, // DXT23_SRGB
262 4, // DXT45_SRGB 284 4, // DXT45_SRGB
263 4, // BC7U_SRGB 285 4, // BC7U_SRGB
286 1, // R4G4B4A4U
264 4, // ASTC_2D_4X4_SRGB 287 4, // ASTC_2D_4X4_SRGB
265 8, // ASTC_2D_8X8_SRGB 288 8, // ASTC_2D_8X8_SRGB
266 8, // ASTC_2D_8X5_SRGB 289 8, // ASTC_2D_8X5_SRGB
@@ -269,6 +292,16 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
269 5, // ASTC_2D_5X5_SRGB 292 5, // ASTC_2D_5X5_SRGB
270 10, // ASTC_2D_10X8 293 10, // ASTC_2D_10X8
271 10, // ASTC_2D_10X8_SRGB 294 10, // ASTC_2D_10X8_SRGB
295 6, // ASTC_2D_6X6
296 6, // ASTC_2D_6X6_SRGB
297 10, // ASTC_2D_10X10
298 10, // ASTC_2D_10X10_SRGB
299 12, // ASTC_2D_12X12
300 12, // ASTC_2D_12X12_SRGB
301 8, // ASTC_2D_8X6
302 8, // ASTC_2D_8X6_SRGB
303 6, // ASTC_2D_6X5
304 6, // ASTC_2D_6X5_SRGB
272 1, // Z32F 305 1, // Z32F
273 1, // Z16 306 1, // Z16
274 1, // Z24S8 307 1, // Z24S8
@@ -285,71 +318,82 @@ static constexpr u32 GetDefaultBlockWidth(PixelFormat format) {
285} 318}
286 319
287constexpr std::array<u32, MaxPixelFormat> block_height_table = {{ 320constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
288 1, // ABGR8U 321 1, // ABGR8U
289 1, // ABGR8S 322 1, // ABGR8S
290 1, // ABGR8UI 323 1, // ABGR8UI
291 1, // B5G6R5U 324 1, // B5G6R5U
292 1, // A2B10G10R10U 325 1, // A2B10G10R10U
293 1, // A1B5G5R5U 326 1, // A1B5G5R5U
294 1, // R8U 327 1, // R8U
295 1, // R8UI 328 1, // R8UI
296 1, // RGBA16F 329 1, // RGBA16F
297 1, // RGBA16U 330 1, // RGBA16U
298 1, // RGBA16UI 331 1, // RGBA16UI
299 1, // R11FG11FB10F 332 1, // R11FG11FB10F
300 1, // RGBA32UI 333 1, // RGBA32UI
301 4, // DXT1 334 4, // DXT1
302 4, // DXT23 335 4, // DXT23
303 4, // DXT45 336 4, // DXT45
304 4, // DXN1 337 4, // DXN1
305 4, // DXN2UNORM 338 4, // DXN2UNORM
306 4, // DXN2SNORM 339 4, // DXN2SNORM
307 4, // BC7U 340 4, // BC7U
308 4, // BC6H_UF16 341 4, // BC6H_UF16
309 4, // BC6H_SF16 342 4, // BC6H_SF16
310 4, // ASTC_2D_4X4 343 4, // ASTC_2D_4X4
311 1, // BGRA8 344 1, // BGRA8
312 1, // RGBA32F 345 1, // RGBA32F
313 1, // RG32F 346 1, // RG32F
314 1, // R32F 347 1, // R32F
315 1, // R16F 348 1, // R16F
316 1, // R16U 349 1, // R16U
317 1, // R16S 350 1, // R16S
318 1, // R16UI 351 1, // R16UI
319 1, // R16I 352 1, // R16I
320 1, // RG16 353 1, // RG16
321 1, // RG16F 354 1, // RG16F
322 1, // RG16UI 355 1, // RG16UI
323 1, // RG16I 356 1, // RG16I
324 1, // RG16S 357 1, // RG16S
325 1, // RGB32F 358 1, // RGB32F
326 1, // RGBA8_SRGB 359 1, // RGBA8_SRGB
327 1, // RG8U 360 1, // RG8U
328 1, // RG8S 361 1, // RG8S
329 1, // RG32UI 362 1, // RG32UI
330 1, // RGBX16F 363 1, // RGBX16F
331 1, // R32UI 364 1, // R32UI
332 8, // ASTC_2D_8X8 365 8, // ASTC_2D_8X8
333 5, // ASTC_2D_8X5 366 5, // ASTC_2D_8X5
334 4, // ASTC_2D_5X4 367 4, // ASTC_2D_5X4
335 1, // BGRA8_SRGB 368 1, // BGRA8_SRGB
336 4, // DXT1_SRGB 369 4, // DXT1_SRGB
337 4, // DXT23_SRGB 370 4, // DXT23_SRGB
338 4, // DXT45_SRGB 371 4, // DXT45_SRGB
339 4, // BC7U_SRGB 372 4, // BC7U_SRGB
340 4, // ASTC_2D_4X4_SRGB 373 1, // R4G4B4A4U
341 8, // ASTC_2D_8X8_SRGB 374 4, // ASTC_2D_4X4_SRGB
342 5, // ASTC_2D_8X5_SRGB 375 8, // ASTC_2D_8X8_SRGB
343 4, // ASTC_2D_5X4_SRGB 376 5, // ASTC_2D_8X5_SRGB
344 5, // ASTC_2D_5X5 377 4, // ASTC_2D_5X4_SRGB
345 5, // ASTC_2D_5X5_SRGB 378 5, // ASTC_2D_5X5
346 8, // ASTC_2D_10X8 379 5, // ASTC_2D_5X5_SRGB
347 8, // ASTC_2D_10X8_SRGB 380 8, // ASTC_2D_10X8
348 1, // Z32F 381 8, // ASTC_2D_10X8_SRGB
349 1, // Z16 382 6, // ASTC_2D_6X6
350 1, // Z24S8 383 6, // ASTC_2D_6X6_SRGB
351 1, // S8Z24 384 10, // ASTC_2D_10X10
352 1, // Z32FS8 385 10, // ASTC_2D_10X10_SRGB
386 12, // ASTC_2D_12X12
387 12, // ASTC_2D_12X12_SRGB
388 6, // ASTC_2D_8X6
389 6, // ASTC_2D_8X6_SRGB
390 5, // ASTC_2D_6X5
391 5, // ASTC_2D_6X5_SRGB
392 1, // Z32F
393 1, // Z16
394 1, // Z24S8
395 1, // S8Z24
396 1, // Z32FS8
353}}; 397}};
354 398
355static constexpr u32 GetDefaultBlockHeight(PixelFormat format) { 399static constexpr u32 GetDefaultBlockHeight(PixelFormat format) {
@@ -413,6 +457,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
413 128, // DXT23_SRGB 457 128, // DXT23_SRGB
414 128, // DXT45_SRGB 458 128, // DXT45_SRGB
415 128, // BC7U 459 128, // BC7U
460 16, // R4G4B4A4U
416 128, // ASTC_2D_4X4_SRGB 461 128, // ASTC_2D_4X4_SRGB
417 128, // ASTC_2D_8X8_SRGB 462 128, // ASTC_2D_8X8_SRGB
418 128, // ASTC_2D_8X5_SRGB 463 128, // ASTC_2D_8X5_SRGB
@@ -421,6 +466,16 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
421 128, // ASTC_2D_5X5_SRGB 466 128, // ASTC_2D_5X5_SRGB
422 128, // ASTC_2D_10X8 467 128, // ASTC_2D_10X8
423 128, // ASTC_2D_10X8_SRGB 468 128, // ASTC_2D_10X8_SRGB
469 128, // ASTC_2D_6X6
470 128, // ASTC_2D_6X6_SRGB
471 128, // ASTC_2D_10X10
472 128, // ASTC_2D_10X10_SRGB
473 128, // ASTC_2D_12X12
474 128, // ASTC_2D_12X12_SRGB
475 128, // ASTC_2D_8X6
476 128, // ASTC_2D_8X6_SRGB
477 128, // ASTC_2D_6X5
478 128, // ASTC_2D_6X5_SRGB
424 32, // Z32F 479 32, // Z32F
425 16, // Z16 480 16, // Z16
426 32, // Z24S8 481 32, // Z24S8
@@ -504,6 +559,7 @@ constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table
504 SurfaceCompression::Compressed, // DXT23_SRGB 559 SurfaceCompression::Compressed, // DXT23_SRGB
505 SurfaceCompression::Compressed, // DXT45_SRGB 560 SurfaceCompression::Compressed, // DXT45_SRGB
506 SurfaceCompression::Compressed, // BC7U_SRGB 561 SurfaceCompression::Compressed, // BC7U_SRGB
562 SurfaceCompression::None, // R4G4B4A4U
507 SurfaceCompression::Converted, // ASTC_2D_4X4_SRGB 563 SurfaceCompression::Converted, // ASTC_2D_4X4_SRGB
508 SurfaceCompression::Converted, // ASTC_2D_8X8_SRGB 564 SurfaceCompression::Converted, // ASTC_2D_8X8_SRGB
509 SurfaceCompression::Converted, // ASTC_2D_8X5_SRGB 565 SurfaceCompression::Converted, // ASTC_2D_8X5_SRGB
@@ -512,6 +568,16 @@ constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table
512 SurfaceCompression::Converted, // ASTC_2D_5X5_SRGB 568 SurfaceCompression::Converted, // ASTC_2D_5X5_SRGB
513 SurfaceCompression::Converted, // ASTC_2D_10X8 569 SurfaceCompression::Converted, // ASTC_2D_10X8
514 SurfaceCompression::Converted, // ASTC_2D_10X8_SRGB 570 SurfaceCompression::Converted, // ASTC_2D_10X8_SRGB
571 SurfaceCompression::Converted, // ASTC_2D_6X6
572 SurfaceCompression::Converted, // ASTC_2D_6X6_SRGB
573 SurfaceCompression::Converted, // ASTC_2D_10X10
574 SurfaceCompression::Converted, // ASTC_2D_10X10_SRGB
575 SurfaceCompression::Converted, // ASTC_2D_12X12
576 SurfaceCompression::Converted, // ASTC_2D_12X12_SRGB
577 SurfaceCompression::Converted, // ASTC_2D_8X6
578 SurfaceCompression::Converted, // ASTC_2D_8X6_SRGB
579 SurfaceCompression::Converted, // ASTC_2D_6X5
580 SurfaceCompression::Converted, // ASTC_2D_6X5_SRGB
515 SurfaceCompression::None, // Z32F 581 SurfaceCompression::None, // Z32F
516 SurfaceCompression::None, // Z16 582 SurfaceCompression::None, // Z16
517 SurfaceCompression::None, // Z24S8 583 SurfaceCompression::None, // Z24S8