summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-26 01:52:39 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 20:52:46 +0100
commite1a16a52fa14835efe6ba9b7418be419cdc4e5d5 (patch)
treeeaef33afaba0f9e7c084cf879e65ce68026fb67d
parentgl_state: Remove primitive restart tracking (diff)
downloadyuzu-e1a16a52fa14835efe6ba9b7418be419cdc4e5d5.tar
yuzu-e1a16a52fa14835efe6ba9b7418be419cdc4e5d5.tar.gz
yuzu-e1a16a52fa14835efe6ba9b7418be419cdc4e5d5.tar.bz2
yuzu-e1a16a52fa14835efe6ba9b7418be419cdc4e5d5.tar.lz
yuzu-e1a16a52fa14835efe6ba9b7418be419cdc4e5d5.tar.xz
yuzu-e1a16a52fa14835efe6ba9b7418be419cdc4e5d5.tar.zst
yuzu-e1a16a52fa14835efe6ba9b7418be419cdc4e5d5.zip
-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);