From 45e4c3df6c00ac98ff6144de9af574877d4fff19 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 11 Sep 2012 17:17:07 -0700 Subject: Discard framebuffer commands when we redraw the entire buffer Change-Id: I32e3014832cbd3bdbace8c3d2206eb20a2002d64 --- libs/hwui/OpenGLRenderer.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libs/hwui/OpenGLRenderer.cpp') diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index f4c2675..02448e8 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -173,6 +173,15 @@ int OpenGLRenderer::prepareDirty(float left, float top, float right, float botto mSnapshot->setClip(left, top, right, bottom); mDirtyClip = opaque; + // If we know that we are going to redraw the entire framebuffer, + // perform a discard to let the driver know we don't need to preserve + // the back buffer for this frame. + if (mCaches.extensions.hasDiscardFramebuffer() && + left <= 0.0f && top <= 0.0f && right >= mWidth && bottom >= mHeight) { + const GLenum attachments[] = { getTargetFbo() == 0 ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0 }; + glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, attachments); + } + syncState(); if (!opaque) { -- cgit v1.1