Просмотр исходного кода

gl_state: Remove rasterizer disable tracking

ReinUsesLisp 6 лет назад
Родитель
Сommit
e8125af8dd

+ 4 - 4
src/video_core/renderer_opengl/gl_rasterizer.cpp

@@ -462,7 +462,7 @@ void RasterizerOpenGL::Clear() {
 
 
     ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil);
     ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil);
 
 
-    SyncRasterizeEnable(clear_state);
+    SyncRasterizeEnable();
     if (regs.clear_flags.scissor) {
     if (regs.clear_flags.scissor) {
         SyncScissorTest();
         SyncScissorTest();
     }
     }
@@ -494,7 +494,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
     query_cache.UpdateCounters();
     query_cache.UpdateCounters();
 
 
     SyncViewport();
     SyncViewport();
-    SyncRasterizeEnable(state);
+    SyncRasterizeEnable();
     SyncColorMask();
     SyncColorMask();
     SyncFragmentColorClampState();
     SyncFragmentColorClampState();
     SyncMultiSampleState();
     SyncMultiSampleState();
@@ -1048,9 +1048,9 @@ void RasterizerOpenGL::SyncStencilTestState() {
     }
     }
 }
 }
 
 
-void RasterizerOpenGL::SyncRasterizeEnable(OpenGLState& current_state) {
+void RasterizerOpenGL::SyncRasterizeEnable() {
     const auto& regs = system.GPU().Maxwell3D().regs;
     const auto& regs = system.GPU().Maxwell3D().regs;
-    current_state.rasterizer_discard = regs.rasterize_enable == 0;
+    oglEnable(GL_RASTERIZER_DISCARD, regs.rasterize_enable == 0);
 }
 }
 
 
 void RasterizerOpenGL::SyncColorMask() {
 void RasterizerOpenGL::SyncColorMask() {

+ 1 - 1
src/video_core/renderer_opengl/gl_rasterizer.h

@@ -176,7 +176,7 @@ private:
     void SyncPointState();
     void SyncPointState();
 
 
     /// Syncs the rasterizer enable state to match the guest state
     /// Syncs the rasterizer enable state to match the guest state
-    void SyncRasterizeEnable(OpenGLState& current_state);
+    void SyncRasterizeEnable();
 
 
     /// Syncs Color Mask
     /// Syncs Color Mask
     void SyncColorMask();
     void SyncColorMask();

+ 0 - 5
src/video_core/renderer_opengl/gl_state.cpp

@@ -113,10 +113,6 @@ void OpenGLState::ApplyClipDistances() {
     }
     }
 }
 }
 
 
-void OpenGLState::ApplyRasterizerDiscard() {
-    Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard);
-}
-
 void OpenGLState::ApplyStencilTest() {
 void OpenGLState::ApplyStencilTest() {
     Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
     Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled);
 
 
@@ -254,7 +250,6 @@ void OpenGLState::Apply() {
     ApplyShaderProgram();
     ApplyShaderProgram();
     ApplyProgramPipeline();
     ApplyProgramPipeline();
     ApplyClipDistances();
     ApplyClipDistances();
-    ApplyRasterizerDiscard();
     ApplyStencilTest();
     ApplyStencilTest();
     ApplyBlending();
     ApplyBlending();
     ApplyTextures();
     ApplyTextures();

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

@@ -13,8 +13,6 @@ namespace OpenGL {
 
 
 class OpenGLState {
 class OpenGLState {
 public:
 public:
-    bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD
-
     struct {
     struct {
         bool test_enabled = false; // GL_STENCIL_TEST
         bool test_enabled = false; // GL_STENCIL_TEST
         struct {
         struct {
@@ -79,7 +77,6 @@ public:
     void ApplyShaderProgram();
     void ApplyShaderProgram();
     void ApplyProgramPipeline();
     void ApplyProgramPipeline();
     void ApplyClipDistances();
     void ApplyClipDistances();
-    void ApplyRasterizerDiscard();
     void ApplyStencilTest();
     void ApplyStencilTest();
     void ApplyTargetBlending(std::size_t target, bool force);
     void ApplyTargetBlending(std::size_t target, bool force);
     void ApplyGlobalBlending();
     void ApplyGlobalBlending();

+ 2 - 0
src/video_core/renderer_opengl/gl_texture_cache.cpp

@@ -536,6 +536,8 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view,
     } else {
     } else {
         glDisable(GL_FRAMEBUFFER_SRGB);
         glDisable(GL_FRAMEBUFFER_SRGB);
     }
     }
+    // TODO(Rodrigo): Find out if rasterizer discard affects blits
+    glDisable(GL_RASTERIZER_DISCARD);
     glDisablei(GL_SCISSOR_TEST, 0);
     glDisablei(GL_SCISSOR_TEST, 0);
 
 
     u32 buffers{};
     u32 buffers{};

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

@@ -580,6 +580,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
     glDisable(GL_ALPHA_TEST);
     glDisable(GL_ALPHA_TEST);
     glDisable(GL_DEPTH_TEST);
     glDisable(GL_DEPTH_TEST);
     glDisable(GL_POLYGON_OFFSET_FILL);
     glDisable(GL_POLYGON_OFFSET_FILL);
+    glDisable(GL_RASTERIZER_DISCARD);
     glDisablei(GL_SCISSOR_TEST, 0);
     glDisablei(GL_SCISSOR_TEST, 0);
     glCullFace(GL_BACK);
     glCullFace(GL_BACK);
     glFrontFace(GL_CW);
     glFrontFace(GL_CW);