VERY experimental Nintendo Switch 2 emulator
C++
video_core: Fix B5G6R5_UNORM render target format
ReinUsesLisp46c327d2d9f4
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cppindex 889f7caacc..7f239566a7 100644--- a/src/video_core/morton.cpp+++ b/src/video_core/morton.cpp@@ -46,6 +46,7 @@ static constexpr ConversionArray morton_to_linear_fns = {MortonCopy<true, PixelFormat::ABGR8I>,MortonCopy<true, PixelFormat::ABGR8UI>,MortonCopy<true, PixelFormat::B5G6R5U>,+ MortonCopy<true, PixelFormat::B5G5R5A1U>,MortonCopy<true, PixelFormat::A2B10G10R10U>,MortonCopy<true, PixelFormat::A2B10G10R10UI>,MortonCopy<true, PixelFormat::A1B5G5R5U>,@@ -137,6 +138,7 @@ static constexpr ConversionArray linear_to_morton_fns = {MortonCopy<false, PixelFormat::ABGR8I>,MortonCopy<false, PixelFormat::ABGR8UI>,MortonCopy<false, PixelFormat::B5G6R5U>,+ MortonCopy<false, PixelFormat::B5G5R5A1U>,MortonCopy<false, PixelFormat::A2B10G10R10U>,MortonCopy<false, PixelFormat::A2B10G10R10UI>,MortonCopy<false, PixelFormat::A1B5G5R5U>,diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cppindex ccfa7c9fe8..7f85ceca9e 100644--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp@@ -46,6 +46,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format{GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE}, // ABGR8I{GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE}, // ABGR8UI{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // B5G6R5U+ {GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // B5G5R5A1U{GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10U{GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10UI{GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // A1B5G5R5Udiff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cppindex fc53321e54..3cb3b00d9b 100644--- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp+++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp@@ -122,6 +122,7 @@ struct FormatTuple {{VK_FORMAT_A8B8G8R8_SINT_PACK32, Attachable | Storage}, // ABGR8I{VK_FORMAT_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // ABGR8UI{VK_FORMAT_R5G6B5_UNORM_PACK16, Attachable}, // B5G6R5U+ {VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // B5G5R5A1U{VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10U{VK_FORMAT_A2B10G10R10_UINT_PACK32, Attachable | Storage}, // A2B10G10R10UI{VK_FORMAT_A1R5G5B5_UNORM_PACK16, Attachable}, // A1B5G5R5U (flipped with swizzle)diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cppindex ea1e20de71..c1c2f2c524 100644--- a/src/video_core/surface.cpp+++ b/src/video_core/surface.cpp@@ -155,7 +155,7 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)case Tegra::RenderTargetFormat::B5G6R5_UNORM:return PixelFormat::B5G6R5U;case Tegra::RenderTargetFormat::BGR5A1_UNORM:- return PixelFormat::A1B5G5R5U;+ return PixelFormat::B5G5R5A1U;case Tegra::RenderTargetFormat::RG8_UNORM:return PixelFormat::RG8U;case Tegra::RenderTargetFormat::RG8_SNORM:diff --git a/src/video_core/surface.h b/src/video_core/surface.hindex aec6b1734a..9510db2c87 100644--- a/src/video_core/surface.h+++ b/src/video_core/surface.h@@ -20,6 +20,7 @@ enum class PixelFormat {ABGR8I,ABGR8UI,B5G6R5U,+ B5G5R5A1U,A2B10G10R10U,A2B10G10R10UI,A1B5G5R5U,@@ -143,6 +144,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{0, // ABGR8I0, // ABGR8UI0, // B5G6R5U+ 0, // B5G5R5A1U0, // A2B10G10R10U0, // A2B10G10R10UI0, // A1B5G5R5U@@ -250,6 +252,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{1, // ABGR8I1, // ABGR8UI1, // B5G6R5U+ 1, // B5G5R5A1U1, // A2B10G10R10U1, // A2B10G10R10UI1, // A1B5G5R5U@@ -349,6 +352,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{1, // ABGR8I1, // ABGR8UI1, // B5G6R5U+ 1, // B5G5R5A1U1, // A2B10G10R10U1, // A2B10G10R10UI1, // A1B5G5R5U@@ -448,6 +452,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{32, // ABGR8I32, // ABGR8UI16, // B5G6R5U+ 16, // B5G5R5A1U32, // A2B10G10R10U32, // A2B10G10R10UI16, // A1B5G5R5U