瀏覽代碼

gl_state: Remove alpha test tracking

ReinUsesLisp 6 年之前
父節點
當前提交
f646321dd0

+ 3 - 5
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,
     UNIMPLEMENTED_IF_MSG(regs.alpha_test_enabled != 0 && regs.rt_control.count > 1,
                          "Alpha Testing is enabled with more than one rendertarget");
                          "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
 } // namespace OpenGL

+ 0 - 9
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() {
 void OpenGLState::ApplyClipControl() {
     if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode),
     if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode),
                   std::tie(clip_control.origin, clip_control.depth_mode))) {
                   std::tie(clip_control.origin, clip_control.depth_mode))) {
@@ -441,7 +433,6 @@ void OpenGLState::Apply() {
     ApplySamplers();
     ApplySamplers();
     ApplyImages();
     ApplyImages();
     ApplyPolygonOffset();
     ApplyPolygonOffset();
-    ApplyAlphaTest();
     ApplyClipControl();
     ApplyClipControl();
     ApplyRenderBuffer();
     ApplyRenderBuffer();
 }
 }

+ 0 - 7
src/video_core/renderer_opengl/gl_state.h

@@ -133,12 +133,6 @@ public:
         GLfloat clamp = 0.0f;
         GLfloat clamp = 0.0f;
     } polygon_offset;
     } 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<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCE
     std::array<bool, 8> clip_distance = {}; // GL_CLIP_DISTANCE
 
 
     struct {
     struct {
@@ -182,7 +176,6 @@ public:
     void ApplyImages();
     void ApplyImages();
     void ApplyDepthClamp();
     void ApplyDepthClamp();
     void ApplyPolygonOffset();
     void ApplyPolygonOffset();
-    void ApplyAlphaTest();
     void ApplyClipControl();
     void ApplyClipControl();
     void ApplyRenderBuffer();
     void ApplyRenderBuffer();
 
 

+ 1 - 0
src/video_core/renderer_opengl/renderer_opengl.cpp

@@ -573,6 +573,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
     state.Apply();
     state.Apply();
 
 
     // TODO: Signal state tracker about these changes
     // TODO: Signal state tracker about these changes
+    glDisable(GL_ALPHA_TEST);
     glEnable(GL_CULL_FACE);
     glEnable(GL_CULL_FACE);
     glCullFace(GL_BACK);
     glCullFace(GL_BACK);
     glFrontFace(GL_CW);
     glFrontFace(GL_CW);