GLuint FramebufferManager::GetEFBDepthTexture(const EFBRectangle& sourceRc) { if (m_msaaSamples <= 1) { return m_efbDepth; } else { // Transfer the EFB to a resolved texture. EXT_framebuffer_blit is // required. TargetRectangle targetRc = g_renderer->ConvertEFBRectangle(sourceRc); targetRc.ClampLL(0, 0, m_targetWidth, m_targetHeight); // Resolve. glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_efbFramebuffer); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_resolvedFramebuffer); glBlitFramebufferEXT( targetRc.left, targetRc.top, targetRc.right, targetRc.bottom, targetRc.left, targetRc.top, targetRc.right, targetRc.bottom, GL_DEPTH_BUFFER_BIT, GL_NEAREST ); // Return to EFB. glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_efbFramebuffer); return m_resolvedDepthTexture; } }
GLuint FramebufferManager::GetEFBDepthTexture(const EFBRectangle& sourceRc) { if (m_msaaSamples <= 1) { return m_efbDepth; } else { // Transfer the EFB to a resolved texture. TargetRectangle targetRc = g_renderer->ConvertEFBRectangle(sourceRc); targetRc.ClampLL(0, 0, m_targetWidth, m_targetHeight); // Resolve. for (unsigned int i = 0; i < m_EFBLayers; i++) { glBindFramebuffer(GL_READ_FRAMEBUFFER, m_efbFramebuffer[i]); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_resolvedFramebuffer[i]); glBlitFramebuffer( targetRc.left, targetRc.top, targetRc.right, targetRc.bottom, targetRc.left, targetRc.top, targetRc.right, targetRc.bottom, GL_DEPTH_BUFFER_BIT, GL_NEAREST ); } // Return to EFB. glBindFramebuffer(GL_FRAMEBUFFER, m_efbFramebuffer[0]); return m_resolvedDepthTexture; } }