VERY experimental Nintendo Switch 2 emulator
C++
gl_rasterizer: Implement render target format RG8_SNORM.
bunnei8cb27339a27e
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cppindex e0fc10a517..834940b83d 100644--- a/src/video_core/gpu.cpp+++ b/src/video_core/gpu.cpp@@ -67,6 +67,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {case RenderTargetFormat::R16_UINT:case RenderTargetFormat::R16_SINT:case RenderTargetFormat::R16_FLOAT:+ case RenderTargetFormat::RG8_SNORM:return 2;case RenderTargetFormat::R8_UNORM:return 1;diff --git a/src/video_core/gpu.h b/src/video_core/gpu.hindex 36918ca168..de5b037bef 100644--- a/src/video_core/gpu.h+++ b/src/video_core/gpu.h@@ -35,6 +35,7 @@ enum class RenderTargetFormat : u32 {R11G11B10_FLOAT = 0xE0,R32_FLOAT = 0xE5,B5G6R5_UNORM = 0xE8,+ RG8_SNORM = 0xEB,R16_UNORM = 0xEE,R16_SNORM = 0xEF,R16_SINT = 0xF0,diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cppindex 5b09236ca7..d055b1dfa6 100644--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp@@ -133,6 +133,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form{GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S{GL_RGB32F, GL_RGB, GL_FLOAT, ComponentType::Float, false}, // RGB32F{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8+ {GL_RG8, GL_RG, GL_BYTE, ComponentType::SNorm, false}, // RG8S// DepthStencil formats{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,@@ -249,9 +250,9 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUMortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>,MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>,MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>,- MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,- MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,- MortonCopy<true, PixelFormat::Z32FS8>,+ MortonCopy<true, PixelFormat::RG8S>, MortonCopy<true, PixelFormat::Z24S8>,+ MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,+ MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,};static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr),@@ -293,6 +294,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUMortonCopy<false, PixelFormat::RG16S>,MortonCopy<false, PixelFormat::RGB32F>,MortonCopy<false, PixelFormat::SRGBA8>,+ MortonCopy<false, PixelFormat::RG8S>,MortonCopy<false, PixelFormat::Z24S8>,MortonCopy<false, PixelFormat::S8Z24>,MortonCopy<false, PixelFormat::Z32F>,diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.hindex 826ad29302..d7a43652e7 100644--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h@@ -57,15 +57,16 @@ struct SurfaceParams {RG16S = 31,RGB32F = 32,SRGBA8 = 33,+ RG8S = 34,MaxColorFormat,// DepthStencil formats- Z24S8 = 34,- S8Z24 = 35,- Z32F = 36,- Z16 = 37,- Z32FS8 = 38,+ Z24S8 = 35,+ S8Z24 = 36,+ Z32F = 37,+ Z16 = 38,+ Z32FS8 = 39,MaxDepthStencilFormat,@@ -137,6 +138,7 @@ struct SurfaceParams {1, // RG16S1, // RGB32F1, // SRGBA8+ 1, // RG8S1, // Z24S81, // S8Z241, // Z32F@@ -187,6 +189,7 @@ struct SurfaceParams {32, // RG16S96, // RGB32F32, // SRGBA8+ 16, // RG8S32, // Z24S832, // S8Z2432, // Z32F@@ -257,6 +260,8 @@ struct SurfaceParams {return PixelFormat::RG16;case Tegra::RenderTargetFormat::RG16_SNORM:return PixelFormat::RG16S;+ case Tegra::RenderTargetFormat::RG8_SNORM:+ return PixelFormat::RG8S;case Tegra::RenderTargetFormat::R16_FLOAT:return PixelFormat::R16F;case Tegra::RenderTargetFormat::R16_UNORM:@@ -418,6 +423,7 @@ struct SurfaceParams {case Tegra::RenderTargetFormat::RGBA8_SNORM:case Tegra::RenderTargetFormat::RG16_SNORM:case Tegra::RenderTargetFormat::R16_SNORM:+ case Tegra::RenderTargetFormat::RG8_SNORM:return ComponentType::SNorm;case Tegra::RenderTargetFormat::RGBA16_FLOAT:case Tegra::RenderTargetFormat::R11G11B10_FLOAT: