summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-14 09:38:12 +0200
committerGitHub <noreply@github.com>2018-07-14 09:38:12 +0200
commit81739a5448140d9b8d65c202e8fbd1a50392a71e (patch)
treed8461d109d4e7f8282fff56899e1f07e41fbe241
parentMerge pull request #657 from bunnei/dual-vs (diff)
parentGPU: Always enable the depth write when clearing the depth buffer. (diff)
downloadyuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.tar
yuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.tar.gz
yuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.tar.bz2
yuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.tar.lz
yuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.tar.xz
yuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.tar.zst
yuzu-81739a5448140d9b8d65c202e8fbd1a50392a71e.zip
-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
bool using_depth_fb) {
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
- // Sync the depth test state before configuring the framebuffer surfaces.
- SyncDepthTestState();
-
// TODO(bunnei): Implement this
const bool has_stencil = false;
@@ -389,6 +386,13 @@ void RasterizerOpenGL::Clear() {
if (regs.clear_buffers.Z) {
clear_mask |= GL_DEPTH_BUFFER_BIT;
use_depth_fb = true;
+
+ // Always enable the depth write when clearing the depth buffer. The depth write mask is
+ // ignored when clearing the buffer in the Switch, but OpenGL obeys it so we set it to true.
+ state.depth.test_enabled = true;
+ state.depth.write_mask = GL_TRUE;
+ state.depth.test_func = GL_ALWAYS;
+ state.Apply();
}
if (clear_mask == 0)
@@ -423,6 +427,7 @@ void RasterizerOpenGL::DrawArrays() {
auto [dirty_color_surface, dirty_depth_surface] =
ConfigureFramebuffers(true, regs.zeta.Address() != 0);
+ SyncDepthTestState();
SyncBlendState();
SyncCullMode();