VERY experimental Nintendo Switch 2 emulator
C++
VideoCore: Implement formats needed for N64 emulation.
Fernando Sahmkow602cb1e42f91
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.hindex dfe7f26ca2..0044212365 100644--- a/src/video_core/renderer_opengl/maxwell_to_gl.h+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h@@ -87,7 +87,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB{GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB{GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM}, // BC7_SRGB{GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, // A4B4G4R4_UNORM- {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R4G4_UNORM+ {GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // G4R4_UNORM{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR}, // ASTC_2D_4X4_SRGB{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR}, // ASTC_2D_8X8_SRGB{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR}, // ASTC_2D_8X5_SRGBdiff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cppindex 6703b8e688..e7104d377c 100644--- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp+++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp@@ -184,7 +184,7 @@ struct FormatTuple {{VK_FORMAT_BC3_SRGB_BLOCK}, // BC3_SRGB{VK_FORMAT_BC7_SRGB_BLOCK}, // BC7_SRGB{VK_FORMAT_R4G4B4A4_UNORM_PACK16, Attachable}, // A4B4G4R4_UNORM- {VK_FORMAT_R4G4_UNORM_PACK8}, // R4G4_UNORM+ {VK_FORMAT_R4G4_UNORM_PACK8}, // G4R4_UNORM{VK_FORMAT_ASTC_4x4_SRGB_BLOCK}, // ASTC_2D_4X4_SRGB{VK_FORMAT_ASTC_8x8_SRGB_BLOCK}, // ASTC_2D_8X8_SRGB{VK_FORMAT_ASTC_8x5_SRGB_BLOCK}, // ASTC_2D_8X5_SRGBdiff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cppindex caca79d79f..8d2728cd78 100644--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp@@ -592,7 +592,7 @@ void TryTransformSwizzleIfNeeded(PixelFormat format, std::array<SwizzleSource, 4case PixelFormat::A5B5G5R1_UNORM:std::ranges::transform(swizzle, swizzle.begin(), SwapSpecial);break;- case PixelFormat::R4G4_UNORM:+ case PixelFormat::G4R4_UNORM:std::ranges::transform(swizzle, swizzle.begin(), SwapGreenRed);break;default:diff --git a/src/video_core/surface.h b/src/video_core/surface.hindex 5fd82357ce..57ca7f597d 100644--- a/src/video_core/surface.h+++ b/src/video_core/surface.h@@ -82,7 +82,7 @@ enum class PixelFormat {BC3_SRGB,BC7_SRGB,A4B4G4R4_UNORM,- R4G4_UNORM,+ G4R4_UNORM,ASTC_2D_4X4_SRGB,ASTC_2D_8X8_SRGB,ASTC_2D_8X5_SRGB,@@ -218,7 +218,7 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{4, // BC3_SRGB4, // BC7_SRGB1, // A4B4G4R4_UNORM- 1, // R4G4_UNORM+ 1, // G4R4_UNORM4, // ASTC_2D_4X4_SRGB8, // ASTC_2D_8X8_SRGB8, // ASTC_2D_8X5_SRGB@@ -323,7 +323,7 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{4, // BC3_SRGB4, // BC7_SRGB1, // A4B4G4R4_UNORM- 1, // R4G4_UNORM+ 1, // G4R4_UNORM4, // ASTC_2D_4X4_SRGB8, // ASTC_2D_8X8_SRGB5, // ASTC_2D_8X5_SRGB@@ -428,7 +428,7 @@ constexpr std::array<u8, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{128, // BC3_SRGB128, // BC7_UNORM16, // A4B4G4R4_UNORM- 8, // R4G4_UNORM+ 8, // G4R4_UNORM128, // ASTC_2D_4X4_SRGB128, // ASTC_2D_8X8_SRGB128, // ASTC_2D_8X5_SRGBdiff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cppindex c71694d2ab..ad935d3860 100644--- a/src/video_core/texture_cache/format_lookup_table.cpp+++ b/src/video_core/texture_cache/format_lookup_table.cpp@@ -63,7 +63,7 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red,case Hash(TextureFormat::A4B4G4R4, UNORM):return PixelFormat::A4B4G4R4_UNORM;case Hash(TextureFormat::G4R4, UNORM):- return PixelFormat::R4G4_UNORM;+ return PixelFormat::G4R4_UNORM;case Hash(TextureFormat::A5B5G5R1, UNORM):return PixelFormat::A5B5G5R1_UNORM;case Hash(TextureFormat::R8, UNORM):diff --git a/src/video_core/texture_cache/formatter.h b/src/video_core/texture_cache/formatter.hindex 6881e4c901..acc8547159 100644--- a/src/video_core/texture_cache/formatter.h+++ b/src/video_core/texture_cache/formatter.h@@ -153,8 +153,8 @@ struct fmt::formatter<VideoCore::Surface::PixelFormat> : fmt::formatter<fmt::strreturn "BC7_SRGB";case PixelFormat::A4B4G4R4_UNORM:return "A4B4G4R4_UNORM";- case PixelFormat::R4G4_UNORM:- return "R4G4_UNORM";+ case PixelFormat::G4R4_UNORM:+ return "G4R4_UNORM";case PixelFormat::ASTC_2D_4X4_SRGB:return "ASTC_2D_4X4_SRGB";case PixelFormat::ASTC_2D_8X8_SRGB: