summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp18
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp15
-rw-r--r--src/video_core/renderer_opengl/gl_state.h7
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp1
4 files changed, 7 insertions, 34 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 975cd2f12..6bb6f9f47 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -446,12 +446,8 @@ void RasterizerOpenGL::Clear() {
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!");
use_depth = 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.
- clear_state.depth.test_enabled = true;
- clear_state.depth.test_func = GL_ALWAYS;
- clear_state.depth.write_mask = GL_TRUE;
+ // TODO: Signal state tracker about these changes
+ glDepthMask(GL_TRUE);
}
if (regs.clear_buffers.S) {
ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear stencil but buffer is not enabled!");
@@ -1036,14 +1032,12 @@ void RasterizerOpenGL::SyncPrimitiveRestart() {
void RasterizerOpenGL::SyncDepthTestState() {
const auto& regs = system.GPU().Maxwell3D().regs;
- state.depth.test_enabled = regs.depth_test_enable != 0;
- state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE;
+ glDepthMask(regs.depth_write_enabled ? GL_TRUE : GL_FALSE);
- if (!state.depth.test_enabled) {
- return;
+ oglEnable(GL_DEPTH_TEST, regs.depth_test_enable);
+ if (regs.depth_test_enable) {
+ glDepthFunc(MaxwellToGL::ComparisonOp(regs.depth_test_func));
}
-
- state.depth.test_func = MaxwellToGL::ComparisonOp(regs.depth_test_func);
}
void RasterizerOpenGL::SyncStencilTestState() {
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index 49a15f82f..45fa3042d 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -183,20 +183,6 @@ void OpenGLState::ApplyColorMask() {
}
}
-void OpenGLState::ApplyDepth() {
- Enable(GL_DEPTH_TEST, cur_state.depth.test_enabled, depth.test_enabled);
-
- if (cur_state.depth.test_func != depth.test_func) {
- cur_state.depth.test_func = depth.test_func;
- glDepthFunc(depth.test_func);
- }
-
- if (cur_state.depth.write_mask != depth.write_mask) {
- cur_state.depth.write_mask = depth.write_mask;
- glDepthMask(depth.write_mask);
- }
-}
-
void OpenGLState::ApplyStencilTest() {
Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
@@ -380,7 +366,6 @@ void OpenGLState::Apply() {
ApplyViewport();
ApplyStencilTest();
ApplySRgb();
- ApplyDepth();
ApplyBlending();
ApplyTextures();
ApplySamplers();
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index 938222d38..036eeae97 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -31,12 +31,6 @@ public:
bool near_plane = false;
} depth_clamp; // GL_DEPTH_CLAMP
- struct {
- bool test_enabled = false; // GL_DEPTH_TEST
- GLboolean write_mask = GL_TRUE; // GL_DEPTH_WRITEMASK
- GLenum test_func = GL_LESS; // GL_DEPTH_FUNC
- } depth;
-
bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
struct ColorMask {
@@ -137,7 +131,6 @@ public:
void ApplySRgb();
void ApplyRasterizerDiscard();
void ApplyColorMask();
- void ApplyDepth();
void ApplyStencilTest();
void ApplyViewport();
void ApplyTargetBlending(std::size_t target, bool force);
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 104b11b0d..9cd67e05e 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -576,6 +576,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
glEnable(GL_CULL_FACE);
glDisable(GL_COLOR_LOGIC_OP);
glDisable(GL_ALPHA_TEST);
+ glDisable(GL_DEPTH_TEST);
glDisable(GL_POLYGON_OFFSET_FILL);
glCullFace(GL_BACK);
glFrontFace(GL_CW);