VERY experimental Nintendo Switch 2 emulator
C++
Texture Cache: Add ASTC 10x5 Format.
Fernando Sahmkowb7df4e83d162
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.hindex 9a72d0d6d5..dfe7f26ca2 100644--- a/src/video_core/renderer_opengl/maxwell_to_gl.h+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h@@ -99,6 +99,8 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB{GL_COMPRESSED_RGBA_ASTC_6x6_KHR}, // ASTC_2D_6X6_UNORM{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR}, // ASTC_2D_6X6_SRGB{GL_COMPRESSED_RGBA_ASTC_10x6_KHR}, // ASTC_2D_10X6_UNORM+ {GL_COMPRESSED_RGBA_ASTC_10x5_KHR}, // ASTC_2D_10X5_UNORM+ {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR}, // ASTC_2D_10X5_SRGB{GL_COMPRESSED_RGBA_ASTC_10x10_KHR}, // ASTC_2D_10X10_UNORM{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR}, // ASTC_2D_10X10_SRGB{GL_COMPRESSED_RGBA_ASTC_12x12_KHR}, // ASTC_2D_12X12_UNORMdiff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cppindex bdb71dc538..6703b8e688 100644--- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp+++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp@@ -196,6 +196,8 @@ struct FormatTuple {{VK_FORMAT_ASTC_6x6_UNORM_BLOCK}, // ASTC_2D_6X6_UNORM{VK_FORMAT_ASTC_6x6_SRGB_BLOCK}, // ASTC_2D_6X6_SRGB{VK_FORMAT_ASTC_10x6_UNORM_BLOCK}, // ASTC_2D_10X6_UNORM+ {VK_FORMAT_ASTC_10x5_UNORM_BLOCK}, // ASTC_2D_10X5_UNORM+ {VK_FORMAT_ASTC_10x5_SRGB_BLOCK}, // ASTC_2D_10X5_SRGB{VK_FORMAT_ASTC_10x10_UNORM_BLOCK}, // ASTC_2D_10X10_UNORM{VK_FORMAT_ASTC_10x10_SRGB_BLOCK}, // ASTC_2D_10X10_SRGB{VK_FORMAT_ASTC_12x12_UNORM_BLOCK}, // ASTC_2D_12X12_UNORMdiff --git a/src/video_core/surface.cpp b/src/video_core/surface.cppindex 079d5f028a..a2bf082941 100644--- a/src/video_core/surface.cpp+++ b/src/video_core/surface.cpp@@ -247,6 +247,8 @@ bool IsPixelFormatASTC(PixelFormat format) {case PixelFormat::ASTC_2D_6X6_UNORM:case PixelFormat::ASTC_2D_6X6_SRGB:case PixelFormat::ASTC_2D_10X6_UNORM:+ case PixelFormat::ASTC_2D_10X5_UNORM:+ case PixelFormat::ASTC_2D_10X5_SRGB:case PixelFormat::ASTC_2D_10X10_UNORM:case PixelFormat::ASTC_2D_10X10_SRGB:case PixelFormat::ASTC_2D_12X12_UNORM:@@ -276,6 +278,7 @@ bool IsPixelFormatSRGB(PixelFormat format) {case PixelFormat::ASTC_2D_5X5_SRGB:case PixelFormat::ASTC_2D_10X8_SRGB:case PixelFormat::ASTC_2D_6X6_SRGB:+ case PixelFormat::ASTC_2D_10X5_SRGB:case PixelFormat::ASTC_2D_10X10_SRGB:case PixelFormat::ASTC_2D_12X12_SRGB:case PixelFormat::ASTC_2D_8X6_SRGB:diff --git a/src/video_core/surface.h b/src/video_core/surface.hindex 16273f185a..5fd82357ce 100644--- a/src/video_core/surface.h+++ b/src/video_core/surface.h@@ -94,6 +94,8 @@ enum class PixelFormat {ASTC_2D_6X6_UNORM,ASTC_2D_6X6_SRGB,ASTC_2D_10X6_UNORM,+ ASTC_2D_10X5_UNORM,+ ASTC_2D_10X5_SRGB,ASTC_2D_10X10_UNORM,ASTC_2D_10X10_SRGB,ASTC_2D_12X12_UNORM,@@ -228,6 +230,8 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{6, // ASTC_2D_6X6_UNORM6, // ASTC_2D_6X6_SRGB10, // ASTC_2D_10X6_UNORM+ 10, // ASTC_2D_10X5_UNORM+ 10, // ASTC_2D_10X5_SRGB10, // ASTC_2D_10X10_UNORM10, // ASTC_2D_10X10_SRGB12, // ASTC_2D_12X12_UNORM@@ -331,6 +335,8 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{6, // ASTC_2D_6X6_UNORM6, // ASTC_2D_6X6_SRGB6, // ASTC_2D_10X6_UNORM+ 5, // ASTC_2D_10X5_UNORM+ 5, // ASTC_2D_10X5_SRGB10, // ASTC_2D_10X10_UNORM10, // ASTC_2D_10X10_SRGB12, // ASTC_2D_12X12_UNORM@@ -434,6 +440,8 @@ constexpr std::array<u8, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{128, // ASTC_2D_6X6_UNORM128, // ASTC_2D_6X6_SRGB128, // ASTC_2D_10X6_UNORM+ 128, // ASTC_2D_10X5_UNORM+ 128, // ASTC_2D_10X5_SRGB128, // ASTC_2D_10X10_UNORM128, // ASTC_2D_10X10_SRGB128, // ASTC_2D_12X12_UNORMdiff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cppindex 1412aa0761..c71694d2ab 100644--- a/src/video_core/texture_cache/format_lookup_table.cpp+++ b/src/video_core/texture_cache/format_lookup_table.cpp@@ -208,6 +208,10 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red,return PixelFormat::ASTC_2D_6X6_SRGB;case Hash(TextureFormat::ASTC_2D_10X6, UNORM, LINEAR):return PixelFormat::ASTC_2D_10X6_UNORM;+ case Hash(TextureFormat::ASTC_2D_10X5, UNORM, LINEAR):+ return PixelFormat::ASTC_2D_10X5_UNORM;+ case Hash(TextureFormat::ASTC_2D_10X5, UNORM, SRGB):+ return PixelFormat::ASTC_2D_10X5_SRGB;case Hash(TextureFormat::ASTC_2D_10X10, UNORM, LINEAR):return PixelFormat::ASTC_2D_10X10_UNORM;case Hash(TextureFormat::ASTC_2D_10X10, UNORM, SRGB):diff --git a/src/video_core/texture_cache/formatter.h b/src/video_core/texture_cache/formatter.hindex 95a5726047..6881e4c901 100644--- a/src/video_core/texture_cache/formatter.h+++ b/src/video_core/texture_cache/formatter.h@@ -177,6 +177,10 @@ struct fmt::formatter<VideoCore::Surface::PixelFormat> : fmt::formatter<fmt::strreturn "ASTC_2D_6X6_SRGB";case PixelFormat::ASTC_2D_10X6_UNORM:return "ASTC_2D_10X6_UNORM";+ case PixelFormat::ASTC_2D_10X5_UNORM:+ return "ASTC_2D_10X5_UNORM";+ case PixelFormat::ASTC_2D_10X5_SRGB:+ return "ASTC_2D_10X5_SRGB";case PixelFormat::ASTC_2D_10X10_UNORM:return "ASTC_2D_10X10_UNORM";case PixelFormat::ASTC_2D_10X10_SRGB: