From e8125af8dd8efac3f7171e234b5aee6edfadc626 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 26 Dec 2019 02:11:01 -0300 Subject: gl_state: Remove rasterizer disable tracking --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 8 ++++---- src/video_core/renderer_opengl/gl_rasterizer.h | 2 +- src/video_core/renderer_opengl/gl_state.cpp | 5 ----- src/video_core/renderer_opengl/gl_state.h | 3 --- src/video_core/renderer_opengl/gl_texture_cache.cpp | 2 ++ src/video_core/renderer_opengl/renderer_opengl.cpp | 1 + 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 63295761a..cb3c81398 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -462,7 +462,7 @@ void RasterizerOpenGL::Clear() { ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil); - SyncRasterizeEnable(clear_state); + SyncRasterizeEnable(); if (regs.clear_flags.scissor) { SyncScissorTest(); } @@ -494,7 +494,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) { query_cache.UpdateCounters(); SyncViewport(); - SyncRasterizeEnable(state); + SyncRasterizeEnable(); SyncColorMask(); SyncFragmentColorClampState(); SyncMultiSampleState(); @@ -1048,9 +1048,9 @@ void RasterizerOpenGL::SyncStencilTestState() { } } -void RasterizerOpenGL::SyncRasterizeEnable(OpenGLState& current_state) { +void RasterizerOpenGL::SyncRasterizeEnable() { 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() { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index d1d0aec32..de21a3511 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -176,7 +176,7 @@ private: void SyncPointState(); /// Syncs the rasterizer enable state to match the guest state - void SyncRasterizeEnable(OpenGLState& current_state); + void SyncRasterizeEnable(); /// Syncs Color Mask void SyncColorMask(); diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 7c08cc3c2..96c3f40f4 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/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() { Enable(GL_STENCIL_TEST, cur_state.stencil.test_enabled, stencil.test_enabled); @@ -254,7 +250,6 @@ void OpenGLState::Apply() { ApplyShaderProgram(); ApplyProgramPipeline(); ApplyClipDistances(); - ApplyRasterizerDiscard(); ApplyStencilTest(); ApplyBlending(); ApplyTextures(); diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index b4c957c0d..6520c88d2 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h @@ -13,8 +13,6 @@ namespace OpenGL { class OpenGLState { public: - bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD - struct { bool test_enabled = false; // GL_STENCIL_TEST struct { @@ -79,7 +77,6 @@ public: void ApplyShaderProgram(); void ApplyProgramPipeline(); void ApplyClipDistances(); - void ApplyRasterizerDiscard(); void ApplyStencilTest(); void ApplyTargetBlending(std::size_t target, bool force); void ApplyGlobalBlending(); diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index f6cb02c53..ed2daf74c 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -536,6 +536,8 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view, } else { glDisable(GL_FRAMEBUFFER_SRGB); } + // TODO(Rodrigo): Find out if rasterizer discard affects blits + glDisable(GL_RASTERIZER_DISCARD); glDisablei(GL_SCISSOR_TEST, 0); u32 buffers{}; diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 12e820979..d18adaddc 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/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_DEPTH_TEST); glDisable(GL_POLYGON_OFFSET_FILL); + glDisable(GL_RASTERIZER_DISCARD); glDisablei(GL_SCISSOR_TEST, 0); glCullFace(GL_BACK); glFrontFace(GL_CW); -- cgit v1.2.3