From 84debc17d530dc3324c06a971d61fadf1cedf1e4 Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 9 Jan 2013 01:50:52 +0100 Subject: [PATCH] fix msaa blitting between msaa fbos may not scale. So we need to resolve the efb before swapping. --- Source/Core/DolphinWX/Src/GLInterface/GLX.cpp | 2 -- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp b/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp index ef60873531..578479f77c 100644 --- a/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp +++ b/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp @@ -60,8 +60,6 @@ bool cInterfaceGLX::Create(void *&window_handle) GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, - GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0, - GLX_SAMPLES_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0, None }; int attrListDefault[] = { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index f5f28d7036..03ee535141 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1149,15 +1149,15 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons //bool applyShader = PostProcessing::ApplyShader(); // degasus: disabled for blitting - // Render to the real buffer now. - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // switch to the window backbuffer - // Copy the framebuffer to screen. const XFBSourceBase* xfbSource = NULL; if(g_ActiveConfig.bUseXFB) { + // Render to the real buffer now. + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // switch to the window backbuffer + // draw each xfb source glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetXFBFramebuffer()); @@ -1211,7 +1211,16 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons { TargetRectangle targetRc = ConvertEFBRectangle(rc); - glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetEFBFramebuffer()); + // for msaa mode, we must resolve the efb content to non-msaa + FramebufferManager::ResolveAndGetRenderTarget(rc); + + // Render to the real buffer now. (resolve have changed this in msaa mode) + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + + // always the non-msaa fbo + GLuint fb = s_MSAASamples>1?FramebufferManager::GetResolvedFramebuffer():FramebufferManager::GetEFBFramebuffer(); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, fb); glBlitFramebuffer(targetRc.left, targetRc.bottom, targetRc.right, targetRc.top, flipped_trc.left, flipped_trc.bottom, flipped_trc.right, flipped_trc.top, GL_COLOR_BUFFER_BIT, GL_LINEAR);