From f646321dd060572f94c2d4f2f3aa2c5307e21b14 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Wed, 25 Dec 2019 20:03:40 -0300 Subject: [PATCH] gl_state: Remove alpha test tracking --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 8 +++----- src/video_core/renderer_opengl/gl_state.cpp | 9 --------- src/video_core/renderer_opengl/gl_state.h | 7 ------- src/video_core/renderer_opengl/renderer_opengl.cpp | 1 + 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index a080c3e81..d1034c2a2 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -1225,12 +1225,10 @@ void RasterizerOpenGL::SyncAlphaTest() { UNIMPLEMENTED_IF_MSG(regs.alpha_test_enabled != 0 && regs.rt_control.count > 1, "Alpha Testing is enabled with more than one rendertarget"); - state.alpha_test.enabled = regs.alpha_test_enabled; - if (!state.alpha_test.enabled) { - return; + oglEnable(GL_ALPHA_TEST, regs.alpha_test_enabled); + if (regs.alpha_test_enabled) { + glAlphaFunc(MaxwellToGL::ComparisonOp(regs.alpha_test_func), regs.alpha_test_ref); } - state.alpha_test.func = MaxwellToGL::ComparisonOp(regs.alpha_test_func); - state.alpha_test.ref = regs.alpha_test_ref; } } // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 08e86b599..59fd8e421 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -368,14 +368,6 @@ void OpenGLState::ApplyPolygonOffset() { } } -void OpenGLState::ApplyAlphaTest() { - Enable(GL_ALPHA_TEST, cur_state.alpha_test.enabled, alpha_test.enabled); - if (UpdateTie(std::tie(cur_state.alpha_test.func, cur_state.alpha_test.ref), - std::tie(alpha_test.func, alpha_test.ref))) { - glAlphaFunc(alpha_test.func, alpha_test.ref); - } -} - void OpenGLState::ApplyClipControl() { if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode), std::tie(clip_control.origin, clip_control.depth_mode))) { @@ -441,7 +433,6 @@ void OpenGLState::Apply() { ApplySamplers(); ApplyImages(); ApplyPolygonOffset(); - ApplyAlphaTest(); ApplyClipControl(); ApplyRenderBuffer(); } diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index ae30b9565..f0e02e717 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h @@ -133,12 +133,6 @@ public: GLfloat clamp = 0.0f; } polygon_offset; - struct { - bool enabled = false; // GL_ALPHA_TEST - GLenum func = GL_ALWAYS; // GL_ALPHA_TEST_FUNC - GLfloat ref = 0.0f; // GL_ALPHA_TEST_REF - } alpha_test; - std::array clip_distance = {}; // GL_CLIP_DISTANCE struct { @@ -182,7 +176,6 @@ public: void ApplyImages(); void ApplyDepthClamp(); void ApplyPolygonOffset(); - void ApplyAlphaTest(); void ApplyClipControl(); void ApplyRenderBuffer(); diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 3d6125dc1..0879a5fb1 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -573,6 +573,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x, state.Apply(); // TODO: Signal state tracker about these changes + glDisable(GL_ALPHA_TEST); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CW);