From 7292ea6a043d51907c9ce1d612f144aa65048350 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 18 Oct 2014 09:32:24 +0200 Subject: OGL: force enable postprocessing --- Source/Core/VideoBackends/OGL/Render.cpp | 52 ++++++++------------------------ 1 file changed, 12 insertions(+), 40 deletions(-) (limited to 'Source/Core/VideoBackends/OGL/Render.cpp') diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 6bd9004808..1511bad54d 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1395,7 +1395,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co ResetAPIState(); - m_post_processor->Update(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); TargetRectangle flipped_trc = GetTargetRectangle(); @@ -1412,29 +1411,20 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co GL_REPORT_ERRORD(); // Copy the framebuffer to screen. - - const XFBSourceBase* xfbSource = nullptr; + const XFBSource* xfbSource = nullptr; if (g_ActiveConfig.bUseXFB) { - // Render to the real/postprocessing buffer now. - m_post_processor->BindTargetFramebuffer(); - // draw each xfb source - glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetXFBFramebuffer()); - for (u32 i = 0; i < xfbCount; ++i) { - xfbSource = xfbSourceList[i]; + xfbSource = (const XFBSource*) xfbSourceList[i]; - MathUtil::Rectangle drawRc; + TargetRectangle drawRc; if (g_ActiveConfig.bUseRealXFB) { - drawRc.top = static_cast(flipped_trc.top); - drawRc.bottom = static_cast(flipped_trc.bottom); - drawRc.left = static_cast(flipped_trc.left); - drawRc.right = static_cast(flipped_trc.right); + drawRc = flipped_trc; } else { @@ -1443,17 +1433,10 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co int xfbWidth = xfbSource->srcWidth; int hOffset = ((s32)xfbSource->srcAddr - (s32)xfbAddr) / ((s32)fbStride * 2); - MathUtil::Rectangle rect_u32; - - rect_u32.top = flipped_trc.top - hOffset * flipped_trc.GetHeight() / fbHeight; - rect_u32.bottom = flipped_trc.top - (hOffset + xfbHeight) * flipped_trc.GetHeight() / fbHeight; - rect_u32.left = flipped_trc.left + (flipped_trc.GetWidth() - xfbWidth * flipped_trc.GetWidth() / fbStride)/2; - rect_u32.right = flipped_trc.left + (flipped_trc.GetWidth() + xfbWidth * flipped_trc.GetWidth() / fbStride)/2; - - drawRc.top = static_cast(rect_u32.top); - drawRc.bottom = static_cast(rect_u32.bottom); - drawRc.left = static_cast(rect_u32.left); - drawRc.right = static_cast(rect_u32.right); + drawRc.top = flipped_trc.top - hOffset * flipped_trc.GetHeight() / fbHeight; + drawRc.bottom = flipped_trc.top - (hOffset + xfbHeight) * flipped_trc.GetHeight() / fbHeight; + drawRc.left = flipped_trc.left + (flipped_trc.GetWidth() - xfbWidth * flipped_trc.GetWidth() / fbStride) / 2; + drawRc.right = flipped_trc.left + (flipped_trc.GetWidth() + xfbWidth * flipped_trc.GetWidth() / fbStride) / 2; // The following code disables auto stretch. Kept for reference. // scale draw area for a 1 to 1 pixel mapping with the draw target @@ -1467,7 +1450,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co // Tell the OSD Menu about the current internal resolution OSDInternalW = xfbSource->sourceRc.GetWidth(); OSDInternalH = xfbSource->sourceRc.GetHeight(); - MathUtil::Rectangle sourceRc; + TargetRectangle sourceRc; sourceRc.left = xfbSource->sourceRc.left; sourceRc.right = xfbSource->sourceRc.right; sourceRc.top = xfbSource->sourceRc.top; @@ -1475,7 +1458,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co sourceRc.right -= fbStride - fbWidth; - xfbSource->Draw(sourceRc, drawRc); + m_post_processor->BlitFromTexture(sourceRc, drawRc, xfbSource->texture, xfbSource->texWidth, xfbSource->texHeight); } } else @@ -1483,22 +1466,11 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co TargetRectangle targetRc = ConvertEFBRectangle(rc); // for msaa mode, we must resolve the efb content to non-msaa - FramebufferManager::ResolveAndGetRenderTarget(rc); - - // Render to the real/postprocessing buffer now. (resolve have changed this in msaa mode) - m_post_processor->BindTargetFramebuffer(); + GLuint tex = FramebufferManager::ResolveAndGetRenderTarget(rc); - // 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); + m_post_processor->BlitFromTexture(targetRc, flipped_trc, tex, s_target_width, s_target_height); } - m_post_processor->BlitToScreen(); - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); // Save screenshot -- cgit v1.2.3