From f158198ccc3a1f53bfebaa6b8f4426e80e1867ea Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Thu, 31 Jan 2013 17:20:30 -0800 Subject: Discard the correct buffer when the bound FBO is not 0 glDiscardFramebufferEXT uses different constants depending on whether the default FBO is bound or not. The code was choosing the proper value for the color buffer but not for the stencil buffer. Change-Id: I55cfcbdf663582119cb1a6289317016440d9e361 --- libs/hwui/OpenGLRenderer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libs/hwui/OpenGLRenderer.cpp') diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 7772f3ac7250..c08cc56f51b8 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -206,8 +206,10 @@ void OpenGLRenderer::discardFramebuffer(float left, float top, float right, floa // 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 ? (const GLenum) GL_COLOR_EXT : - (const GLenum) GL_COLOR_ATTACHMENT0, GL_STENCIL_EXT }; + const bool isFbo = getTargetFbo() == 0; + const GLenum attachments[] = { + isFbo ? (const GLenum) GL_COLOR_EXT : (const GLenum) GL_COLOR_ATTACHMENT0, + isFbo ? (const GLenum) GL_STENCIL_EXT : (const GLenum) GL_STENCIL_ATTACHMENT }; glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, attachments); } } -- cgit v1.2.3-59-g8ed1b