summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar Subv2018-07-14 00:52:23 -0500
committerGravatar Subv2018-07-14 00:52:23 -0500
commitb37354cca8da78bcfc72543615c3dcfa28a7a229 (patch)
treed8461d109d4e7f8282fff56899e1f07e41fbe241 /src/video_core
parentMerge pull request #657 from bunnei/dual-vs (diff)
downloadyuzu-b37354cca8da78bcfc72543615c3dcfa28a7a229.tar.gz
yuzu-b37354cca8da78bcfc72543615c3dcfa28a7a229.tar.xz
yuzu-b37354cca8da78bcfc72543615c3dcfa28a7a229.zip
GPU: Always enable the depth write when clearing the depth buffer.
The GPU ignores that register when clearing, but OpenGL obeys the glDepthMask parameter, so we set the depth mask to GL_TRUE when clearing the depth buffer. It will be restored to the correct value automatically on the next draw call.
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 4072a12b4..1da9e137c 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -322,9 +322,6 @@ std::pair<Surface, Surface> RasterizerOpenGL::ConfigureFramebuffers(bool using_c
322 bool using_depth_fb) { 322 bool using_depth_fb) {
323 const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; 323 const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
324 324
325 // Sync the depth test state before configuring the framebuffer surfaces.
326 SyncDepthTestState();
327
328 // TODO(bunnei): Implement this 325 // TODO(bunnei): Implement this
329 const bool has_stencil = false; 326 const bool has_stencil = false;
330 327
@@ -389,6 +386,13 @@ void RasterizerOpenGL::Clear() {
389 if (regs.clear_buffers.Z) { 386 if (regs.clear_buffers.Z) {
390 clear_mask |= GL_DEPTH_BUFFER_BIT; 387 clear_mask |= GL_DEPTH_BUFFER_BIT;
391 use_depth_fb = true; 388 use_depth_fb = true;
389
390 // Always enable the depth write when clearing the depth buffer. The depth write mask is
391 // ignored when clearing the buffer in the Switch, but OpenGL obeys it so we set it to true.
392 state.depth.test_enabled = true;
393 state.depth.write_mask = GL_TRUE;
394 state.depth.test_func = GL_ALWAYS;
395 state.Apply();
392 } 396 }
393 397
394 if (clear_mask == 0) 398 if (clear_mask == 0)
@@ -423,6 +427,7 @@ void RasterizerOpenGL::DrawArrays() {
423 auto [dirty_color_surface, dirty_depth_surface] = 427 auto [dirty_color_surface, dirty_depth_surface] =
424 ConfigureFramebuffers(true, regs.zeta.Address() != 0); 428 ConfigureFramebuffers(true, regs.zeta.Address() != 0);
425 429
430 SyncDepthTestState();
426 SyncBlendState(); 431 SyncBlendState();
427 SyncCullMode(); 432 SyncCullMode();
428 433