OpenGLDevice: Disable scissor for buffer clears

This commit is contained in:
Stenzek 2023-11-25 00:49:49 +10:00
parent e75c1a3b0a
commit 273979405d
No known key found for this signature in database
2 changed files with 12 additions and 0 deletions

View File

@ -600,7 +600,9 @@ void OpenGLDevice::SetSwapInterval()
void OpenGLDevice::RenderBlankFrame() void OpenGLDevice::RenderBlankFrame()
{ {
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glDisable(GL_SCISSOR_TEST);
glClearBufferfv(GL_COLOR, 0, s_clear_color.data()); glClearBufferfv(GL_COLOR, 0, s_clear_color.data());
glEnable(GL_SCISSOR_TEST);
m_gl_context->SwapBuffers(); m_gl_context->SwapBuffers();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_current_framebuffer ? m_current_framebuffer->GetGLId() : 0); 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); glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDisable(GL_SCISSOR_TEST);
glClearBufferfv(GL_COLOR, 0, s_clear_color.data()); glClearBufferfv(GL_COLOR, 0, s_clear_color.data());
glEnable(GL_SCISSOR_TEST);
const Common::Rectangle<s32> window_rc = const Common::Rectangle<s32> window_rc =
Common::Rectangle<s32>::FromExtents(0, 0, m_window_info.surface_width, m_window_info.surface_height); Common::Rectangle<s32>::FromExtents(0, 0, m_window_info.surface_width, m_window_info.surface_height);

View File

@ -484,12 +484,16 @@ void OpenGLDevice::CommitClear(OpenGLTexture* tex)
if (tex->IsDepthStencil()) if (tex->IsDepthStencil())
{ {
const float depth = tex->GetClearDepth(); const float depth = tex->GetClearDepth();
glDisable(GL_SCISSOR_TEST);
glClearBufferfv(GL_DEPTH, 0, &depth); glClearBufferfv(GL_DEPTH, 0, &depth);
glEnable(GL_SCISSOR_TEST);
} }
else else
{ {
const auto color = tex->GetUNormClearColor(); const auto color = tex->GetUNormClearColor();
glDisable(GL_SCISSOR_TEST);
glClearBufferfv(GL_COLOR, 0, color.data()); glClearBufferfv(GL_COLOR, 0, color.data());
glEnable(GL_SCISSOR_TEST);
} }
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attachment, GL_TEXTURE_2D, 0, 0); glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attachment, GL_TEXTURE_2D, 0, 0);
@ -526,7 +530,9 @@ void OpenGLDevice::CommitClear(OpenGLFramebuffer* fb)
case GPUTexture::State::Cleared: case GPUTexture::State::Cleared:
{ {
const auto color = FB->GetUNormClearColor(); const auto color = FB->GetUNormClearColor();
glDisable(GL_SCISSOR_TEST);
glClearBufferfv(GL_COLOR, 0, color.data()); glClearBufferfv(GL_COLOR, 0, color.data());
glEnable(GL_SCISSOR_TEST);
FB->SetState(GPUTexture::State::Dirty); FB->SetState(GPUTexture::State::Dirty);
} }
@ -552,7 +558,9 @@ void OpenGLDevice::CommitClear(OpenGLFramebuffer* fb)
case GPUTexture::State::Cleared: case GPUTexture::State::Cleared:
{ {
const float depth = DS->GetClearDepth(); const float depth = DS->GetClearDepth();
glDisable(GL_SCISSOR_TEST);
glClearBufferfv(GL_DEPTH, 0, &depth); glClearBufferfv(GL_DEPTH, 0, &depth);
glEnable(GL_SCISSOR_TEST);
DS->SetState(GPUTexture::State::Dirty); DS->SetState(GPUTexture::State::Dirty);
} }
break; break;