diff options
| author | Romain Guy <romainguy@google.com> | 2012-09-11 17:17:07 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2012-09-11 17:30:43 -0700 |
| commit | 45e4c3df6c00ac98ff6144de9af574877d4fff19 (patch) | |
| tree | 206209b5faf3bb4c63366d29e8891bc53783d232 /libs/hwui/OpenGLRenderer.cpp | |
| parent | f625436cc741932518e5f1a41586c72ac8297ece (diff) | |
| download | frameworks_base-45e4c3df6c00ac98ff6144de9af574877d4fff19.zip frameworks_base-45e4c3df6c00ac98ff6144de9af574877d4fff19.tar.gz frameworks_base-45e4c3df6c00ac98ff6144de9af574877d4fff19.tar.bz2 | |
Discard framebuffer commands when we redraw the entire buffer
Change-Id: I32e3014832cbd3bdbace8c3d2206eb20a2002d64
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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) { |
