From f98cf76b9779629e7aad2c4666dd836dd8b0ca02 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sun, 4 May 2014 18:42:31 +0800 Subject: [PATCH] Use GL_NV_framebuffer_blit to handle depth copy --- GPU/GLES/Framebuffer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index fefd6d845e..bb0c365d9e 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -954,7 +954,7 @@ void FramebufferManager::BindFramebufferDepth(VirtualFramebuffer *sourceframebuf #ifndef USING_GLES2 if (gl_extensions.FBO_ARB) { #else - if (gl_extensions.GLES3) { + if (gl_extensions.GLES3 || gl_extensions.NV_framebuffer_blit) { #endif #ifdef MAY_HAVE_GLES3 @@ -964,6 +964,17 @@ void FramebufferManager::BindFramebufferDepth(VirtualFramebuffer *sourceframebuf glBlitFramebuffer(0, 0, sourceframebuffer->renderWidth, sourceframebuffer->renderHeight, 0, 0, targetframebuffer->renderWidth, targetframebuffer->renderHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST); // If we set targetframebuffer->depthUpdated here, our optimization above would be pointless. } +#else + // Let's only do this if not clearing. + if (!gstate.isModeClear() || !gstate.isClearModeDepthMask()) { + fbo_bind_for_read(sourceframebuffer->fbo); + // Use the built-in high performance blit function + // http://www.khronos.org/registry/gles/extensions/NV/NV_framebuffer_blit.txt +#ifndef __SYMBIAN32__ + glBlitFramebufferNV(0, 0, sourceframebuffer->renderWidth, sourceframebuffer->renderHeight, 0, 0, targetframebuffer->renderWidth, targetframebuffer->renderHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST); +#endif + // If we set targetframebuffer->depthUpdated here, our optimization above would be pointless. + } #endif } }