From ab1aad3815e5d711aa0b997fbd57fdb36c34f37d Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 8 Mar 2009 21:42:27 +0000 Subject: [PATCH] Remove flicker when switching between native and full resolution from the gl config box. Remove a couple of unnecessary framebuffer binds. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2623 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp | 3 ++- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index e2761150c4..22046344ce 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -544,7 +544,8 @@ void ConfigDialog::UpdateGUI() { // This is only used together with the aspect ratio options m_Crop->Enable(g_Config.bKeepAR43 || g_Config.bKeepAR169); - if (g_Config.bUseXFB) { + if (g_Config.bUseXFB) + { // XFB looks much better if the copy comes from native resolution. g_Config.bNativeResolution = true; m_NativeResolution->SetValue(true); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index edbdb817b5..c7e35891cb 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -113,6 +113,7 @@ static bool s_bHaveFramebufferBlit = false; static bool s_bHaveCoverageMSAA = false; static bool g_bBlendSeparate = false; static u32 s_blendMode; +static bool s_bNativeResolution = false; static volatile bool s_bScreenshot = false; static Common::CriticalSection s_criticalScreenshot; @@ -173,6 +174,7 @@ bool Renderer::Init() bool bSuccess = true; s_blendMode = 0; s_MSAACoverageSamples = 0; + s_bNativeResolution = g_Config.bNativeResolution; switch (g_Config.iMultisampleMode) { case MULTISAMPLE_OFF: s_MSAASamples = 1; break; @@ -540,12 +542,12 @@ bool Renderer::InitializeGL() // ------------------------ int Renderer::GetTargetWidth() { - return g_Config.bNativeResolution ? EFB_WIDTH : s_targetwidth; + return s_bNativeResolution ? EFB_WIDTH : s_targetwidth; } int Renderer::GetTargetHeight() { - return g_Config.bNativeResolution ? EFB_HEIGHT : s_targetheight; + return s_bNativeResolution ? EFB_HEIGHT : s_targetheight; } float Renderer::GetTargetScaleX() @@ -591,7 +593,6 @@ GLuint Renderer::ResolveAndGetRenderTarget(const TRectangle &source_rect) glBlitFramebufferEXT(flipped_rect.left, flipped_rect.top, flipped_rect.right, flipped_rect.bottom, flipped_rect.left, flipped_rect.top, flipped_rect.right, flipped_rect.bottom, GL_COLOR_BUFFER_BIT, GL_NEAREST); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, s_uFramebuffer); // Return the resolved target. return s_ResolvedRenderTarget; @@ -617,7 +618,6 @@ GLuint Renderer::ResolveAndGetFakeZTarget(const TRectangle &source_rect) glBlitFramebufferEXT(flipped_rect.left, flipped_rect.top, flipped_rect.right, flipped_rect.bottom, flipped_rect.left, flipped_rect.top, flipped_rect.right, flipped_rect.bottom, GL_COLOR_BUFFER_BIT, GL_NEAREST); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, s_uFramebuffer); // Return the resolved target. return s_ResolvedFakeZTarget; @@ -841,7 +841,7 @@ void Renderer::FlushZBufferAlphaToTarget() // TODO: This code should not have to bother with stretchtofit checking - // all necessary scale initialization should be done elsewhere. - if (g_Config.bNativeResolution) + if (s_bNativeResolution) { //TODO: Do Correctly in a bit float FactorW = 640.f / (float)OpenGL_GetBackbufferWidth(); @@ -1123,6 +1123,7 @@ void Renderer::Swap(const TRectangle& rc) // Place messages on the picture, then copy it to the screen SwapBuffers(); + s_bNativeResolution = g_Config.bNativeResolution; RestoreGLState();