VERY experimental Nintendo Switch 2 emulator
C++
video_core: Add S8_UINT stencil format
Morphc7bdf8825f0a
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.hindex 05e5c94f3d..c89a5d693c 100644--- a/src/video_core/gpu.h+++ b/src/video_core/gpu.h@@ -83,6 +83,7 @@ enum class DepthFormat : u32 {S8_UINT_Z24_UNORM = 0x14,D24X8_UNORM = 0x15,D24S8_UNORM = 0x16,+ S8_UINT = 0x17,D24C8_UNORM = 0x18,D32_FLOAT_S8X24_UINT = 0x19,};diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cppindex 58d262446f..a36015c8c1 100644--- a/src/video_core/surface.cpp+++ b/src/video_core/surface.cpp@@ -82,6 +82,8 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) {return PixelFormat::D32_FLOAT;case Tegra::DepthFormat::D16_UNORM:return PixelFormat::D16_UNORM;+ case Tegra::DepthFormat::S8_UINT:+ return PixelFormat::S8_UINT;case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT:return PixelFormat::D32_FLOAT_S8_UINT;default:@@ -213,6 +215,11 @@ SurfaceType GetFormatType(PixelFormat pixel_format) {return SurfaceType::Depth;}+ if (static_cast<std::size_t>(pixel_format) <+ static_cast<std::size_t>(PixelFormat::MaxStencilFormat)) {+ return SurfaceType::Stencil;+ }+if (static_cast<std::size_t>(pixel_format) <static_cast<std::size_t>(PixelFormat::MaxDepthStencilFormat)) {return SurfaceType::DepthStencil;diff --git a/src/video_core/surface.h b/src/video_core/surface.hindex 2ce7c7d338..33e8d24ab1 100644--- a/src/video_core/surface.h+++ b/src/video_core/surface.h@@ -110,8 +110,12 @@ enum class PixelFormat {MaxDepthFormat,+ // Stencil formats+ S8_UINT = MaxDepthFormat,+ MaxStencilFormat,+// DepthStencil formats- D24_UNORM_S8_UINT = MaxDepthFormat,+ D24_UNORM_S8_UINT = MaxStencilFormat,S8_UINT_D24_UNORM,D32_FLOAT_S8_UINT,@@ -125,8 +129,9 @@ constexpr std::size_t MaxPixelFormat = static_cast<std::size_t>(PixelFormat::Maxenum class SurfaceType {ColorTexture = 0,Depth = 1,- DepthStencil = 2,- Invalid = 3,+ Stencil = 2,+ DepthStencil = 3,+ Invalid = 4,};enum class SurfaceTarget {@@ -229,6 +234,7 @@ constexpr std::array<u32, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{1, // E5B9G9R9_FLOAT1, // D32_FLOAT1, // D16_UNORM+ 1, // S8_UINT1, // D24_UNORM_S8_UINT1, // S8_UINT_D24_UNORM1, // D32_FLOAT_S8_UINT@@ -328,6 +334,7 @@ constexpr std::array<u32, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{1, // E5B9G9R9_FLOAT1, // D32_FLOAT1, // D16_UNORM+ 1, // S8_UINT1, // D24_UNORM_S8_UINT1, // S8_UINT_D24_UNORM1, // D32_FLOAT_S8_UINT@@ -427,6 +434,7 @@ constexpr std::array<u32, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{32, // E5B9G9R9_FLOAT32, // D32_FLOAT16, // D16_UNORM+ 8, // S8_UINT32, // D24_UNORM_S8_UINT32, // S8_UINT_D24_UNORM64, // D32_FLOAT_S8_UINTdiff --git a/src/video_core/texture_cache/formatter.h b/src/video_core/texture_cache/formatter.hindex c6cf0583fc..b2c81057ba 100644--- a/src/video_core/texture_cache/formatter.h+++ b/src/video_core/texture_cache/formatter.h@@ -194,6 +194,8 @@ struct fmt::formatter<VideoCore::Surface::PixelFormat> : fmt::formatter<fmt::strreturn "D32_FLOAT";case PixelFormat::D16_UNORM:return "D16_UNORM";+ case PixelFormat::S8_UINT:+ return "S8_UINT";case PixelFormat::D24_UNORM_S8_UINT:return "D24_UNORM_S8_UINT";case PixelFormat::S8_UINT_D24_UNORM: