summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar bunnei2018-08-16 18:06:51 -0400
committerGravatar GitHub2018-08-16 18:06:51 -0400
commitce56b8e1fad864cc9a714803beb9db3a707e7c38 (patch)
treee89760f59e5658790ed38067c120092b7986f449 /src/video_core
parentMerge pull request #1085 from lioncash/namespace (diff)
parentgl_rasterizer_cache: Treat Depth formats differently from DepthStencil. (diff)
downloadyuzu-ce56b8e1fad864cc9a714803beb9db3a707e7c38.tar.gz
yuzu-ce56b8e1fad864cc9a714803beb9db3a707e7c38.tar.xz
yuzu-ce56b8e1fad864cc9a714803beb9db3a707e7c38.zip
Merge pull request #1084 from bunnei/depth
gl_rasterizer_cache: Treat Depth formats differently from DepthStencil.
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp18
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h24
2 files changed, 26 insertions, 16 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index b6947b97b..ac4db82cf 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -142,14 +142,16 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
142 {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI 142 {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RG32UI
143 {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI 143 {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // R32UI
144 144
145 // Depth formats
146 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
147 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm,
148 false}, // Z16
149
145 // DepthStencil formats 150 // DepthStencil formats
146 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 151 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
147 false}, // Z24S8 152 false}, // Z24S8
148 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 153 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
149 false}, // S8Z24 154 false}, // S8Z24
150 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
151 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm,
152 false}, // Z16
153 {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 155 {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
154 ComponentType::Float, false}, // Z32FS8 156 ComponentType::Float, false}, // Z32FS8
155}}; 157}};
@@ -283,10 +285,10 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
283 MortonCopy<true, PixelFormat::RG8S>, 285 MortonCopy<true, PixelFormat::RG8S>,
284 MortonCopy<true, PixelFormat::RG32UI>, 286 MortonCopy<true, PixelFormat::RG32UI>,
285 MortonCopy<true, PixelFormat::R32UI>, 287 MortonCopy<true, PixelFormat::R32UI>,
286 MortonCopy<true, PixelFormat::Z24S8>,
287 MortonCopy<true, PixelFormat::S8Z24>,
288 MortonCopy<true, PixelFormat::Z32F>, 288 MortonCopy<true, PixelFormat::Z32F>,
289 MortonCopy<true, PixelFormat::Z16>, 289 MortonCopy<true, PixelFormat::Z16>,
290 MortonCopy<true, PixelFormat::Z24S8>,
291 MortonCopy<true, PixelFormat::S8Z24>,
290 MortonCopy<true, PixelFormat::Z32FS8>, 292 MortonCopy<true, PixelFormat::Z32FS8>,
291 // clang-format on 293 // clang-format on
292}; 294};
@@ -339,10 +341,10 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
339 MortonCopy<false, PixelFormat::RG8S>, 341 MortonCopy<false, PixelFormat::RG8S>,
340 MortonCopy<false, PixelFormat::RG32UI>, 342 MortonCopy<false, PixelFormat::RG32UI>,
341 MortonCopy<false, PixelFormat::R32UI>, 343 MortonCopy<false, PixelFormat::R32UI>,
342 MortonCopy<false, PixelFormat::Z24S8>,
343 MortonCopy<false, PixelFormat::S8Z24>,
344 MortonCopy<false, PixelFormat::Z32F>, 344 MortonCopy<false, PixelFormat::Z32F>,
345 MortonCopy<false, PixelFormat::Z16>, 345 MortonCopy<false, PixelFormat::Z16>,
346 MortonCopy<false, PixelFormat::Z24S8>,
347 MortonCopy<false, PixelFormat::S8Z24>,
346 MortonCopy<false, PixelFormat::Z32FS8>, 348 MortonCopy<false, PixelFormat::Z32FS8>,
347 // clang-format on 349 // clang-format on
348}; 350};
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 55cf3782c..beec01746 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -68,11 +68,15 @@ struct SurfaceParams {
68 68
69 MaxColorFormat, 69 MaxColorFormat,
70 70
71 // Depth formats
72 Z32F = 42,
73 Z16 = 43,
74
75 MaxDepthFormat,
76
71 // DepthStencil formats 77 // DepthStencil formats
72 Z24S8 = 42, 78 Z24S8 = 44,
73 S8Z24 = 43, 79 S8Z24 = 45,
74 Z32F = 44,
75 Z16 = 45,
76 Z32FS8 = 46, 80 Z32FS8 = 46,
77 81
78 MaxDepthStencilFormat, 82 MaxDepthStencilFormat,
@@ -153,10 +157,10 @@ struct SurfaceParams {
153 1, // RG8S 157 1, // RG8S
154 1, // RG32UI 158 1, // RG32UI
155 1, // R32UI 159 1, // R32UI
156 1, // Z24S8
157 1, // S8Z24
158 1, // Z32F 160 1, // Z32F
159 1, // Z16 161 1, // Z16
162 1, // Z24S8
163 1, // S8Z24
160 1, // Z32FS8 164 1, // Z32FS8
161 }}; 165 }};
162 166
@@ -211,10 +215,10 @@ struct SurfaceParams {
211 16, // RG8S 215 16, // RG8S
212 64, // RG32UI 216 64, // RG32UI
213 32, // R32UI 217 32, // R32UI
214 32, // Z24S8
215 32, // S8Z24
216 32, // Z32F 218 32, // Z32F
217 16, // Z16 219 16, // Z16
220 32, // Z24S8
221 32, // S8Z24
218 64, // Z32FS8 222 64, // Z32FS8
219 }}; 223 }};
220 224
@@ -587,6 +591,10 @@ struct SurfaceParams {
587 return SurfaceType::ColorTexture; 591 return SurfaceType::ColorTexture;
588 } 592 }
589 593
594 if (static_cast<size_t>(pixel_format) < static_cast<size_t>(PixelFormat::MaxDepthFormat)) {
595 return SurfaceType::Depth;
596 }
597
590 if (static_cast<size_t>(pixel_format) < 598 if (static_cast<size_t>(pixel_format) <
591 static_cast<size_t>(PixelFormat::MaxDepthStencilFormat)) { 599 static_cast<size_t>(PixelFormat::MaxDepthStencilFormat)) {
592 return SurfaceType::DepthStencil; 600 return SurfaceType::DepthStencil;