From 0eb0c47eba57366bf80d7c69b3a07b5924102c1c Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Fri, 31 Oct 2014 15:24:04 +0100 Subject: [PATCH] Render: Improve SBS presentation. New calculation properly takes pillar boxing into account. --- Source/Core/VideoBackends/OGL/Render.cpp | 26 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 58d3fd0ee3..bba030f209 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1516,10 +1516,17 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co if (g_ActiveConfig.iStereoMode == 1) { + // Resize target to half its original size + int width = drawRc.GetWidth(); + drawRc.left += width / 4; + drawRc.right -= width / 4; + + // Create two target rectangle offset to the sides of the backbuffer TargetRectangle leftRc = drawRc, rightRc = drawRc; - int width = drawRc.right - drawRc.left; - leftRc.right -= width / 2; - rightRc.left += width / 2; + leftRc.left -= s_backbuffer_width / 4; + leftRc.right -= s_backbuffer_width / 4; + rightRc.left += s_backbuffer_width / 4; + rightRc.right += s_backbuffer_width / 4; m_post_processor->BlitFromTexture(sourceRc, leftRc, xfbSource->texture, xfbSource->texWidth, xfbSource->texHeight, 0); m_post_processor->BlitFromTexture(sourceRc, rightRc, xfbSource->texture, xfbSource->texWidth, xfbSource->texHeight, 1); @@ -1539,10 +1546,17 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co if (g_ActiveConfig.iStereoMode == 1) { + // Resize target to half its original size + int width = flipped_trc.GetWidth(); + flipped_trc.left += width / 4; + flipped_trc.right -= width / 4; + + // Create two target rectangle offset to the sides of the backbuffer TargetRectangle leftRc = flipped_trc, rightRc = flipped_trc; - int width = flipped_trc.right - flipped_trc.left; - leftRc.right -= width / 2; - rightRc.left += width / 2; + leftRc.left -= s_backbuffer_width / 4; + leftRc.right -= s_backbuffer_width / 4; + rightRc.left += s_backbuffer_width / 4; + rightRc.right += s_backbuffer_width / 4; m_post_processor->BlitFromTexture(targetRc, leftRc, tex, s_target_width, s_target_height, 0); m_post_processor->BlitFromTexture(targetRc, rightRc, tex, s_target_width, s_target_height, 1);