From 273979405d4730491ac094c008a0e567ce3ccaad Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 25 Nov 2023 00:49:49 +1000 Subject: [PATCH] OpenGLDevice: Disable scissor for buffer clears --- src/util/opengl_device.cpp | 4 ++++ src/util/opengl_texture.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/util/opengl_device.cpp b/src/util/opengl_device.cpp index 429801f27..a3d961462 100644 --- a/src/util/opengl_device.cpp +++ b/src/util/opengl_device.cpp @@ -600,7 +600,9 @@ void OpenGLDevice::SetSwapInterval() void OpenGLDevice::RenderBlankFrame() { glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glDisable(GL_SCISSOR_TEST); glClearBufferfv(GL_COLOR, 0, s_clear_color.data()); + glEnable(GL_SCISSOR_TEST); m_gl_context->SwapBuffers(); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_current_framebuffer ? m_current_framebuffer->GetGLId() : 0); } @@ -696,7 +698,9 @@ bool OpenGLDevice::BeginPresent(bool skip_present) } glBindFramebuffer(GL_FRAMEBUFFER, 0); + glDisable(GL_SCISSOR_TEST); glClearBufferfv(GL_COLOR, 0, s_clear_color.data()); + glEnable(GL_SCISSOR_TEST); const Common::Rectangle window_rc = Common::Rectangle::FromExtents(0, 0, m_window_info.surface_width, m_window_info.surface_height); diff --git a/src/util/opengl_texture.cpp b/src/util/opengl_texture.cpp index f3365298e..966f8ff69 100644 --- a/src/util/opengl_texture.cpp +++ b/src/util/opengl_texture.cpp @@ -484,12 +484,16 @@ void OpenGLDevice::CommitClear(OpenGLTexture* tex) if (tex->IsDepthStencil()) { const float depth = tex->GetClearDepth(); + glDisable(GL_SCISSOR_TEST); glClearBufferfv(GL_DEPTH, 0, &depth); + glEnable(GL_SCISSOR_TEST); } else { const auto color = tex->GetUNormClearColor(); + glDisable(GL_SCISSOR_TEST); glClearBufferfv(GL_COLOR, 0, color.data()); + glEnable(GL_SCISSOR_TEST); } glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attachment, GL_TEXTURE_2D, 0, 0); @@ -526,7 +530,9 @@ void OpenGLDevice::CommitClear(OpenGLFramebuffer* fb) case GPUTexture::State::Cleared: { const auto color = FB->GetUNormClearColor(); + glDisable(GL_SCISSOR_TEST); glClearBufferfv(GL_COLOR, 0, color.data()); + glEnable(GL_SCISSOR_TEST); FB->SetState(GPUTexture::State::Dirty); } @@ -552,7 +558,9 @@ void OpenGLDevice::CommitClear(OpenGLFramebuffer* fb) case GPUTexture::State::Cleared: { const float depth = DS->GetClearDepth(); + glDisable(GL_SCISSOR_TEST); glClearBufferfv(GL_DEPTH, 0, &depth); + glEnable(GL_SCISSOR_TEST); DS->SetState(GPUTexture::State::Dirty); } break;