VERY experimental Nintendo Switch 2 emulator
C++
video_core: Implement RGBA8_SINT render target
ReinUsesLispf8136072ff00
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.hindex b0a2ad21b2..e3ab786e59 100644--- a/src/video_core/gpu.h+++ b/src/video_core/gpu.h@@ -55,6 +55,7 @@ enum class RenderTargetFormat : u32 {RGBA8_UNORM = 0xD5,RGBA8_SRGB = 0xD6,RGBA8_SNORM = 0xD7,+ RGBA8_SINT = 0xD8,RGBA8_UINT = 0xD9,RG16_UNORM = 0xDA,RG16_SNORM = 0xDB,diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cppindex f932df53f2..452e1f01e7 100644--- a/src/video_core/morton.cpp+++ b/src/video_core/morton.cpp@@ -43,6 +43,7 @@ static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depthstatic constexpr ConversionArray morton_to_linear_fns = {MortonCopy<true, PixelFormat::ABGR8U>,MortonCopy<true, PixelFormat::ABGR8S>,+ MortonCopy<true, PixelFormat::ABGR8I>,MortonCopy<true, PixelFormat::ABGR8UI>,MortonCopy<true, PixelFormat::B5G6R5U>,MortonCopy<true, PixelFormat::A2B10G10R10U>,@@ -130,6 +131,7 @@ static constexpr ConversionArray morton_to_linear_fns = {static constexpr ConversionArray linear_to_morton_fns = {MortonCopy<false, PixelFormat::ABGR8U>,MortonCopy<false, PixelFormat::ABGR8S>,+ MortonCopy<false, PixelFormat::ABGR8I>,MortonCopy<false, PixelFormat::ABGR8UI>,MortonCopy<false, PixelFormat::B5G6R5U>,MortonCopy<false, PixelFormat::A2B10G10R10U>,diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cppindex 1d7824324f..396b85e406 100644--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp@@ -43,6 +43,7 @@ struct FormatTuple {constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format_tuples = {{{GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // ABGR8U{GL_RGBA8_SNORM, GL_RGBA, GL_BYTE}, // ABGR8S+ {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_REV}, // B5G6R5U{GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV}, // A2B10G10R10Udiff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cppindex 4086d1bb69..fe3b73a994 100644--- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp+++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp@@ -119,6 +119,7 @@ struct FormatTuple {} constexpr tex_format_tuples[] = {{VK_FORMAT_A8B8G8R8_UNORM_PACK32, Attachable | Storage}, // ABGR8U{VK_FORMAT_A8B8G8R8_SNORM_PACK32, Attachable | Storage}, // ABGR8S+ {VK_FORMAT_A8B8G8R8_SINT_PACK32, Attachable | Storage}, // ABGR8I{VK_FORMAT_A8B8G8R8_UINT_PACK32, Attachable | Storage}, // ABGR8UI{VK_FORMAT_B5G6R5_UNORM_PACK16}, // B5G6R5U{VK_FORMAT_A2B10G10R10_UNORM_PACK32, Attachable | Storage}, // A2B10G10R10Udiff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cppindex e1128efe65..7ae4005a89 100644--- a/src/video_core/renderer_vulkan/vk_device.cpp+++ b/src/video_core/renderer_vulkan/vk_device.cpp@@ -77,6 +77,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(VK_FORMAT_A8B8G8R8_UNORM_PACK32,VK_FORMAT_A8B8G8R8_UINT_PACK32,VK_FORMAT_A8B8G8R8_SNORM_PACK32,+ VK_FORMAT_A8B8G8R8_SINT_PACK32,VK_FORMAT_A8B8G8R8_SRGB_PACK32,VK_FORMAT_B5G6R5_UNORM_PACK16,VK_FORMAT_A2B10G10R10_UNORM_PACK32,diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cppindex 13e598972c..0db995367a 100644--- a/src/video_core/surface.cpp+++ b/src/video_core/surface.cpp@@ -124,6 +124,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)return PixelFormat::RGBA8_SRGB;case Tegra::RenderTargetFormat::RGBA8_SNORM:return PixelFormat::ABGR8S;+ case Tegra::RenderTargetFormat::RGBA8_SINT:+ return PixelFormat::ABGR8I;case Tegra::RenderTargetFormat::RGBA8_UINT:return PixelFormat::ABGR8UI;case Tegra::RenderTargetFormat::RG16_UNORM:diff --git a/src/video_core/surface.h b/src/video_core/surface.hindex 3e9dd797a1..6f3162986c 100644--- a/src/video_core/surface.h+++ b/src/video_core/surface.h@@ -17,6 +17,7 @@ namespace VideoCore::Surface {enum class PixelFormat {ABGR8U,ABGR8S,+ ABGR8I,ABGR8UI,B5G6R5U,A2B10G10R10U,@@ -136,6 +137,7 @@ enum class SurfaceTarget {constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{0, // ABGR8U0, // ABGR8S+ 0, // ABGR8I0, // ABGR8UI0, // B5G6R5U0, // A2B10G10R10U@@ -239,6 +241,7 @@ inline constexpr u32 GetCompressionFactor(PixelFormat format) {constexpr std::array<u32, MaxPixelFormat> block_width_table = {{1, // ABGR8U1, // ABGR8S+ 1, // ABGR8I1, // ABGR8UI1, // B5G6R5U1, // A2B10G10R10U@@ -334,6 +337,7 @@ static constexpr u32 GetDefaultBlockWidth(PixelFormat format) {constexpr std::array<u32, MaxPixelFormat> block_height_table = {{1, // ABGR8U1, // ABGR8S+ 1, // ABGR8I1, // ABGR8UI1, // B5G6R5U1, // A2B10G10R10U@@ -429,6 +433,7 @@ static constexpr u32 GetDefaultBlockHeight(PixelFormat format) {constexpr std::array<u32, MaxPixelFormat> bpp_table = {{32, // ABGR8U32, // ABGR8S+ 32, // ABGR8I32, // ABGR8UI16, // B5G6R5U32, // A2B10G10R10U