diff options
| author | 2021-11-17 15:04:38 -0500 | |
|---|---|---|
| committer | 2021-11-17 15:04:38 -0500 | |
| commit | 2348eb41f38a6e52e52d121adfc4c605763209a7 (patch) | |
| tree | b4bdeb539cc1030fb43f17edbdfee459ca2b843a | |
| parent | Merge pull request #7219 from FernandoS27/aristotles-right-testicle (diff) | |
| download | yuzu-2348eb41f38a6e52e52d121adfc4c605763209a7.tar.gz yuzu-2348eb41f38a6e52e52d121adfc4c605763209a7.tar.xz yuzu-2348eb41f38a6e52e52d121adfc4c605763209a7.zip | |
video_core: Add S8_UINT stencil format
| -rw-r--r-- | src/video_core/gpu.h | 1 | ||||
| -rw-r--r-- | src/video_core/surface.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/surface.h | 14 | ||||
| -rw-r--r-- | src/video_core/texture_cache/formatter.h | 2 |
4 files changed, 21 insertions, 3 deletions
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 05e5c94f3..c89a5d693 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -83,6 +83,7 @@ enum class DepthFormat : u32 { | |||
| 83 | S8_UINT_Z24_UNORM = 0x14, | 83 | S8_UINT_Z24_UNORM = 0x14, |
| 84 | D24X8_UNORM = 0x15, | 84 | D24X8_UNORM = 0x15, |
| 85 | D24S8_UNORM = 0x16, | 85 | D24S8_UNORM = 0x16, |
| 86 | S8_UINT = 0x17, | ||
| 86 | D24C8_UNORM = 0x18, | 87 | D24C8_UNORM = 0x18, |
| 87 | D32_FLOAT_S8X24_UINT = 0x19, | 88 | D32_FLOAT_S8X24_UINT = 0x19, |
| 88 | }; | 89 | }; |
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index 58d262446..a36015c8c 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -82,6 +82,8 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) { | |||
| 82 | return PixelFormat::D32_FLOAT; | 82 | return PixelFormat::D32_FLOAT; |
| 83 | case Tegra::DepthFormat::D16_UNORM: | 83 | case Tegra::DepthFormat::D16_UNORM: |
| 84 | return PixelFormat::D16_UNORM; | 84 | return PixelFormat::D16_UNORM; |
| 85 | case Tegra::DepthFormat::S8_UINT: | ||
| 86 | return PixelFormat::S8_UINT; | ||
| 85 | case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT: | 87 | case Tegra::DepthFormat::D32_FLOAT_S8X24_UINT: |
| 86 | return PixelFormat::D32_FLOAT_S8_UINT; | 88 | return PixelFormat::D32_FLOAT_S8_UINT; |
| 87 | default: | 89 | default: |
| @@ -214,6 +216,11 @@ SurfaceType GetFormatType(PixelFormat pixel_format) { | |||
| 214 | } | 216 | } |
| 215 | 217 | ||
| 216 | if (static_cast<std::size_t>(pixel_format) < | 218 | if (static_cast<std::size_t>(pixel_format) < |
| 219 | static_cast<std::size_t>(PixelFormat::MaxStencilFormat)) { | ||
| 220 | return SurfaceType::Stencil; | ||
| 221 | } | ||
| 222 | |||
| 223 | if (static_cast<std::size_t>(pixel_format) < | ||
| 217 | static_cast<std::size_t>(PixelFormat::MaxDepthStencilFormat)) { | 224 | static_cast<std::size_t>(PixelFormat::MaxDepthStencilFormat)) { |
| 218 | return SurfaceType::DepthStencil; | 225 | return SurfaceType::DepthStencil; |
| 219 | } | 226 | } |
diff --git a/src/video_core/surface.h b/src/video_core/surface.h index 2ce7c7d33..33e8d24ab 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h | |||
| @@ -110,8 +110,12 @@ enum class PixelFormat { | |||
| 110 | 110 | ||
| 111 | MaxDepthFormat, | 111 | MaxDepthFormat, |
| 112 | 112 | ||
| 113 | // Stencil formats | ||
| 114 | S8_UINT = MaxDepthFormat, | ||
| 115 | MaxStencilFormat, | ||
| 116 | |||
| 113 | // DepthStencil formats | 117 | // DepthStencil formats |
| 114 | D24_UNORM_S8_UINT = MaxDepthFormat, | 118 | D24_UNORM_S8_UINT = MaxStencilFormat, |
| 115 | S8_UINT_D24_UNORM, | 119 | S8_UINT_D24_UNORM, |
| 116 | D32_FLOAT_S8_UINT, | 120 | D32_FLOAT_S8_UINT, |
| 117 | 121 | ||
| @@ -125,8 +129,9 @@ constexpr std::size_t MaxPixelFormat = static_cast<std::size_t>(PixelFormat::Max | |||
| 125 | enum class SurfaceType { | 129 | enum class SurfaceType { |
| 126 | ColorTexture = 0, | 130 | ColorTexture = 0, |
| 127 | Depth = 1, | 131 | Depth = 1, |
| 128 | DepthStencil = 2, | 132 | Stencil = 2, |
| 129 | Invalid = 3, | 133 | DepthStencil = 3, |
| 134 | Invalid = 4, | ||
| 130 | }; | 135 | }; |
| 131 | 136 | ||
| 132 | enum class SurfaceTarget { | 137 | enum class SurfaceTarget { |
| @@ -229,6 +234,7 @@ constexpr std::array<u32, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{ | |||
| 229 | 1, // E5B9G9R9_FLOAT | 234 | 1, // E5B9G9R9_FLOAT |
| 230 | 1, // D32_FLOAT | 235 | 1, // D32_FLOAT |
| 231 | 1, // D16_UNORM | 236 | 1, // D16_UNORM |
| 237 | 1, // S8_UINT | ||
| 232 | 1, // D24_UNORM_S8_UINT | 238 | 1, // D24_UNORM_S8_UINT |
| 233 | 1, // S8_UINT_D24_UNORM | 239 | 1, // S8_UINT_D24_UNORM |
| 234 | 1, // D32_FLOAT_S8_UINT | 240 | 1, // D32_FLOAT_S8_UINT |
| @@ -328,6 +334,7 @@ constexpr std::array<u32, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{ | |||
| 328 | 1, // E5B9G9R9_FLOAT | 334 | 1, // E5B9G9R9_FLOAT |
| 329 | 1, // D32_FLOAT | 335 | 1, // D32_FLOAT |
| 330 | 1, // D16_UNORM | 336 | 1, // D16_UNORM |
| 337 | 1, // S8_UINT | ||
| 331 | 1, // D24_UNORM_S8_UINT | 338 | 1, // D24_UNORM_S8_UINT |
| 332 | 1, // S8_UINT_D24_UNORM | 339 | 1, // S8_UINT_D24_UNORM |
| 333 | 1, // D32_FLOAT_S8_UINT | 340 | 1, // D32_FLOAT_S8_UINT |
| @@ -427,6 +434,7 @@ constexpr std::array<u32, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{ | |||
| 427 | 32, // E5B9G9R9_FLOAT | 434 | 32, // E5B9G9R9_FLOAT |
| 428 | 32, // D32_FLOAT | 435 | 32, // D32_FLOAT |
| 429 | 16, // D16_UNORM | 436 | 16, // D16_UNORM |
| 437 | 8, // S8_UINT | ||
| 430 | 32, // D24_UNORM_S8_UINT | 438 | 32, // D24_UNORM_S8_UINT |
| 431 | 32, // S8_UINT_D24_UNORM | 439 | 32, // S8_UINT_D24_UNORM |
| 432 | 64, // D32_FLOAT_S8_UINT | 440 | 64, // D32_FLOAT_S8_UINT |
diff --git a/src/video_core/texture_cache/formatter.h b/src/video_core/texture_cache/formatter.h index c6cf0583f..b2c81057b 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::str | |||
| 194 | return "D32_FLOAT"; | 194 | return "D32_FLOAT"; |
| 195 | case PixelFormat::D16_UNORM: | 195 | case PixelFormat::D16_UNORM: |
| 196 | return "D16_UNORM"; | 196 | return "D16_UNORM"; |
| 197 | case PixelFormat::S8_UINT: | ||
| 198 | return "S8_UINT"; | ||
| 197 | case PixelFormat::D24_UNORM_S8_UINT: | 199 | case PixelFormat::D24_UNORM_S8_UINT: |
| 198 | return "D24_UNORM_S8_UINT"; | 200 | return "D24_UNORM_S8_UINT"; |
| 199 | case PixelFormat::S8_UINT_D24_UNORM: | 201 | case PixelFormat::S8_UINT_D24_UNORM: |