From 12412ac5b70266176982ae74a2bd4a8ba333f8f9 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Sat, 20 Dec 2014 16:48:57 +0100 Subject: [PATCH] FramebufferManager: Copy all EFB layers to the XFB framebuffer. --- .../VideoBackends/OGL/FramebufferManager.cpp | 19 +++++++++++-------- .../VideoBackends/OGL/FramebufferManager.h | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp index 731cf389d2..cd37e228a4 100644 --- a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp @@ -509,17 +509,20 @@ void XFBSource::CopyEFB(float Gamma) g_renderer->ResetAPIState(); // Copy EFB data to XFB and restore render target again - glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetEFBFramebuffer()); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, FramebufferManager::GetXFBFramebuffer()); - // Bind texture. - FramebufferManager::FramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_ARRAY, texture, 0); + for (int i = 0; i < m_layers; i++) + { + // Bind EFB and texture layer + glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetEFBFramebuffer(i)); + glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0, i); - glBlitFramebuffer( - 0, 0, texWidth, texHeight, - 0, 0, texWidth, texHeight, - GL_COLOR_BUFFER_BIT, GL_NEAREST - ); + glBlitFramebuffer( + 0, 0, texWidth, texHeight, + 0, 0, texWidth, texHeight, + GL_COLOR_BUFFER_BIT, GL_NEAREST + ); + } // Return to EFB. FramebufferManager::SetFramebuffer(0); diff --git a/Source/Core/VideoBackends/OGL/FramebufferManager.h b/Source/Core/VideoBackends/OGL/FramebufferManager.h index ffc2970ee6..3fb553d8dc 100644 --- a/Source/Core/VideoBackends/OGL/FramebufferManager.h +++ b/Source/Core/VideoBackends/OGL/FramebufferManager.h @@ -68,7 +68,7 @@ public: static GLuint GetEFBColorTexture(const EFBRectangle& sourceRc); static GLuint GetEFBDepthTexture(const EFBRectangle& sourceRc); - static GLuint GetEFBFramebuffer() { return m_efbFramebuffer[0]; } + static GLuint GetEFBFramebuffer(unsigned int layer = 0) { return (layer < m_EFBLayers) ? m_efbFramebuffer[layer] : m_efbFramebuffer[m_EFBLayers - 1]; } static GLuint GetXFBFramebuffer() { return m_xfbFramebuffer; } // Resolved framebuffer is only used in MSAA mode.