OGL: Clear backbuffer before presenting instead of at start of frame
This commit is contained in:
parent
456c2f42c3
commit
5baf3bbe2e
|
@ -1331,21 +1331,23 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
|
||||||
// Skip screen rendering when running in headless mode.
|
// Skip screen rendering when running in headless mode.
|
||||||
if (!IsHeadless())
|
if (!IsHeadless())
|
||||||
{
|
{
|
||||||
// Copy the framebuffer to screen.
|
// Clear the framebuffer before drawing anything.
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
glClearColor(0, 0, 0, 0);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
// Copy the framebuffer to screen.
|
||||||
BlitScreen(sourceRc, flipped_trc, xfb_texture->GetRawTexIdentifier(),
|
BlitScreen(sourceRc, flipped_trc, xfb_texture->GetRawTexIdentifier(),
|
||||||
xfb_texture->GetConfig().width, xfb_texture->GetConfig().height);
|
xfb_texture->GetConfig().width, xfb_texture->GetConfig().height);
|
||||||
|
|
||||||
// Finish up the current frame, print some stats
|
// Render OSD messages.
|
||||||
|
glViewport(0, 0, m_backbuffer_width, m_backbuffer_height);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
// Reset viewport for drawing text
|
|
||||||
glViewport(0, 0, GLInterface->GetBackBufferWidth(), GLInterface->GetBackBufferHeight());
|
|
||||||
DrawDebugText();
|
DrawDebugText();
|
||||||
OSD::DrawMessages();
|
OSD::DrawMessages();
|
||||||
|
|
||||||
// Copy the rendered frame to the real window.
|
// Swap the back and front buffers, presenting the image.
|
||||||
GLInterface->Swap();
|
GLInterface->Swap();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1415,13 +1417,6 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
|
||||||
BoundingBox::SetTargetSizeChanged(m_target_width, m_target_height);
|
BoundingBox::SetTargetSizeChanged(m_target_width, m_target_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear framebuffer
|
|
||||||
if (!IsHeadless())
|
|
||||||
{
|
|
||||||
glClearColor(0, 0, 0, 0);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s_vsync != g_ActiveConfig.IsVSync())
|
if (s_vsync != g_ActiveConfig.IsVSync())
|
||||||
{
|
{
|
||||||
s_vsync = g_ActiveConfig.IsVSync();
|
s_vsync = g_ActiveConfig.IsVSync();
|
||||||
|
|
Loading…
Reference in New Issue