OGL: Support stereoscopic XFB blit to screen.

This commit is contained in:
Jules Blok 2014-12-20 17:10:58 +01:00
parent 12412ac5b7
commit a9364cd5db
2 changed files with 20 additions and 15 deletions

View File

@ -1270,6 +1270,22 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
ClearEFBCache();
}
void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, GLuint src_texture, int src_width, int src_height)
{
if (g_ActiveConfig.iStereoMode == STEREO_SBS || g_ActiveConfig.iStereoMode == STEREO_TAB)
{
TargetRectangle leftRc, rightRc;
ConvertStereoRectangle(dst, leftRc, rightRc);
m_post_processor->BlitFromTexture(src, leftRc, src_texture, src_width, src_height, 0);
m_post_processor->BlitFromTexture(src, rightRc, src_texture, src_width, src_height, 1);
}
else
{
m_post_processor->BlitFromTexture(src, dst, src_texture, src_width, src_height);
}
}
void Renderer::ReinterpretPixelData(unsigned int convtype)
{
if (convtype == 0 || convtype == 2)
@ -1473,8 +1489,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
sourceRc.right -= fbStride - fbWidth;
// TODO: Virtual XFB stereoscopic 3D support.
m_post_processor->BlitFromTexture(sourceRc, drawRc, xfbSource->texture, xfbSource->texWidth, xfbSource->texHeight, 1);
BlitScreen(sourceRc, drawRc, xfbSource->texture, xfbSource->texWidth, xfbSource->texHeight);
}
}
else
@ -1483,19 +1498,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
// for msaa mode, we must resolve the efb content to non-msaa
GLuint tex = FramebufferManager::ResolveAndGetRenderTarget(rc);
if (g_ActiveConfig.iStereoMode == STEREO_SBS || g_ActiveConfig.iStereoMode == STEREO_TAB)
{
TargetRectangle leftRc, rightRc;
ConvertStereoRectangle(flipped_trc, leftRc, rightRc);
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);
}
else
{
m_post_processor->BlitFromTexture(targetRc, flipped_trc, tex, s_target_width, s_target_height);
}
BlitScreen(targetRc, flipped_trc, tex, s_target_width, s_target_height);
}
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);

View File

@ -91,6 +91,8 @@ public:
private:
void UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRectangle& efbPixelRc, const TargetRectangle& targetPixelRc, const u32* data);
void BlitScreen(TargetRectangle src, TargetRectangle dst, GLuint src_texture, int src_width, int src_height);
};
}