ogl: reset api state for blitting

glBlitFramebuffer depends on scissior test and color mask. It isn't documented well,
but it does. So we have to reset the apistate before using it.
In this way, there isn't any benefit of glBlitFramebuffer, glDrawArray would be better :-(
This commit is contained in:
degasus 2013-08-26 22:18:00 +02:00
parent 15df7b3445
commit 93f9f23576
2 changed files with 12 additions and 0 deletions

View File

@ -435,6 +435,8 @@ void XFBSource::DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight)
void XFBSource::CopyEFB(float Gamma) void XFBSource::CopyEFB(float Gamma)
{ {
g_renderer->ResetAPIState();
// Copy EFB data to XFB and restore render target again // Copy EFB data to XFB and restore render target again
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetEFBFramebuffer()); glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetEFBFramebuffer());
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, FramebufferManager::GetXFBFramebuffer()); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, FramebufferManager::GetXFBFramebuffer());
@ -452,6 +454,8 @@ void XFBSource::CopyEFB(float Gamma)
// Return to EFB. // Return to EFB.
FramebufferManager::SetFramebuffer(0); FramebufferManager::SetFramebuffer(0);
g_renderer->RestoreAPIState();
} }
XFBSourceBase* FramebufferManager::CreateXFBSource(unsigned int target_width, unsigned int target_height) XFBSourceBase* FramebufferManager::CreateXFBSource(unsigned int target_width, unsigned int target_height)

View File

@ -958,9 +958,13 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
{ {
if (s_MSAASamples > 1) if (s_MSAASamples > 1)
{ {
g_renderer->ResetAPIState();
// Resolve our rectangle. // Resolve our rectangle.
FramebufferManager::GetEFBDepthTexture(efbPixelRc); FramebufferManager::GetEFBDepthTexture(efbPixelRc);
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetResolvedFramebuffer()); glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetResolvedFramebuffer());
g_renderer->RestoreAPIState();
} }
u32* depthMap = new u32[targetPixelRcWidth * targetPixelRcHeight]; u32* depthMap = new u32[targetPixelRcWidth * targetPixelRcHeight];
@ -1007,9 +1011,13 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
{ {
if (s_MSAASamples > 1) if (s_MSAASamples > 1)
{ {
g_renderer->ResetAPIState();
// Resolve our rectangle. // Resolve our rectangle.
FramebufferManager::GetEFBColorTexture(efbPixelRc); FramebufferManager::GetEFBColorTexture(efbPixelRc);
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetResolvedFramebuffer()); glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetResolvedFramebuffer());
g_renderer->RestoreAPIState();
} }
u32* colorMap = new u32[targetPixelRcWidth * targetPixelRcHeight]; u32* colorMap = new u32[targetPixelRcWidth * targetPixelRcHeight];