diff options
| author | skidau <skidau@gmail.com> | 2014-10-25 13:48:27 +1100 |
|---|---|---|
| committer | skidau <skidau@gmail.com> | 2014-10-25 13:48:27 +1100 |
| commit | bc26cb1b19993934abe375eb2f5861c2f1587f8d (patch) | |
| tree | 0bc2606599bb496af2d20e6a74889af5596a5748 /Source/Core/VideoBackends/OGL/Render.cpp | |
| parent | 8598d6bc2b77f908ec0b9673ec342c87a07bfd75 (diff) | |
| parent | 7292ea6a043d51907c9ce1d612f144aa65048350 (diff) | |
Merge pull request #1322 from degasus/ogl-pp
OGL: force enable postprocessing
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Render.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/Render.cpp | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 8b9cd6eb58..2920d33c78 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1396,7 +1396,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(); @@ -1413,29 +1412,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<float> drawRc; + TargetRectangle drawRc; if (g_ActiveConfig.bUseRealXFB) { - drawRc.top = static_cast<float>(flipped_trc.top); - drawRc.bottom = static_cast<float>(flipped_trc.bottom); - drawRc.left = static_cast<float>(flipped_trc.left); - drawRc.right = static_cast<float>(flipped_trc.right); + drawRc = flipped_trc; } else { @@ -1444,17 +1434,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<u32> 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<float>(rect_u32.top); - drawRc.bottom = static_cast<float>(rect_u32.bottom); - drawRc.left = static_cast<float>(rect_u32.left); - drawRc.right = static_cast<float>(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 @@ -1468,7 +1451,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<int> sourceRc; + TargetRectangle sourceRc; sourceRc.left = xfbSource->sourceRc.left; sourceRc.right = xfbSource->sourceRc.right; sourceRc.top = xfbSource->sourceRc.top; @@ -1476,7 +1459,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 @@ -1484,22 +1467,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 |
