From 2392b548bee87553b39f50c1159640b0dabc4b13 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 26 Dec 2019 01:07:34 -0300 Subject: gl_state: Remove clamp framebuffer color tracking This commit doesn't reset it for screen draws because clamping doesn't change anything there. --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 ++++++---- src/video_core/renderer_opengl/gl_state.cpp | 8 -------- src/video_core/renderer_opengl/gl_state.h | 5 ----- 3 files changed, 6 insertions(+), 17 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index dc2d60156..d7971f86f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -415,6 +415,11 @@ void RasterizerOpenGL::Clear() { clear_state.color_mask[0].green_enabled = regs.clear_buffers.G ? GL_TRUE : GL_FALSE; clear_state.color_mask[0].blue_enabled = regs.clear_buffers.B ? GL_TRUE : GL_FALSE; clear_state.color_mask[0].alpha_enabled = regs.clear_buffers.A ? GL_TRUE : GL_FALSE; + + // TODO: Signal state tracker about these changes + SyncFramebufferSRGB(); + // TODO(Rodrigo): Determine if clamping is used on clears + SyncFragmentColorClampState(); } if (regs.clear_buffers.Z) { ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!"); @@ -454,9 +459,6 @@ void RasterizerOpenGL::Clear() { } } - // TODO: Signal state tracker about these changes - SyncFramebufferSRGB(); - if (!use_color && !use_depth && !use_stencil) { // No color surface nor depth/stencil surface are enabled return; @@ -1089,7 +1091,7 @@ void RasterizerOpenGL::SyncMultiSampleState() { void RasterizerOpenGL::SyncFragmentColorClampState() { const auto& regs = system.GPU().Maxwell3D().regs; - state.fragment_color_clamp.enabled = regs.frag_color_clamp != 0; + glClampColor(GL_CLAMP_FRAGMENT_COLOR, regs.frag_color_clamp ? GL_TRUE : GL_FALSE); } void RasterizerOpenGL::SyncBlendState() { diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index b726adfc7..f8325d6e7 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -117,13 +117,6 @@ void OpenGLState::ApplyClipDistances() { } } -void OpenGLState::ApplyFragmentColorClamp() { - if (UpdateValue(cur_state.fragment_color_clamp.enabled, fragment_color_clamp.enabled)) { - glClampColor(GL_CLAMP_FRAGMENT_COLOR_ARB, - fragment_color_clamp.enabled ? GL_TRUE : GL_FALSE); - } -} - void OpenGLState::ApplyRasterizerDiscard() { Enable(GL_RASTERIZER_DISCARD, cur_state.rasterizer_discard, rasterizer_discard); } @@ -317,7 +310,6 @@ void OpenGLState::Apply() { ApplyShaderProgram(); ApplyProgramPipeline(); ApplyClipDistances(); - ApplyFragmentColorClamp(); ApplyRasterizerDiscard(); ApplyColorMask(); ApplyViewport(); diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 5a8a728f2..89eb30dfc 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h @@ -13,10 +13,6 @@ namespace OpenGL { class OpenGLState { public: - struct { - bool enabled = false; // GL_CLAMP_FRAGMENT_COLOR_ARB - } fragment_color_clamp; - bool rasterizer_discard = false; // GL_RASTERIZER_DISCARD struct ColorMask { @@ -110,7 +106,6 @@ public: void ApplyShaderProgram(); void ApplyProgramPipeline(); void ApplyClipDistances(); - void ApplyFragmentColorClamp(); void ApplyRasterizerDiscard(); void ApplyColorMask(); void ApplyStencilTest(); -- cgit v1.2.3