diff options
author | Chris Craik <ccraik@google.com> | 2015-04-29 20:17:42 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-29 20:17:43 +0000 |
commit | 81bd735a010771ab502dabe7ef4d20ea520cf6ac (patch) | |
tree | 3f18d30edaa8cfcbd0434ce69814d1debeca43f5 /libs | |
parent | b2cec86a44f3fe937079b26827bdc031f5aec731 (diff) | |
parent | e145013153b562d0b1bcac3e88095411874f1c25 (diff) | |
download | frameworks_base-81bd735a010771ab502dabe7ef4d20ea520cf6ac.zip frameworks_base-81bd735a010771ab502dabe7ef4d20ea520cf6ac.tar.gz frameworks_base-81bd735a010771ab502dabe7ef4d20ea520cf6ac.tar.bz2 |
Merge "Require minimum 4 bit stencil for layers." into mnc-dev
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 2 | ||||
-rw-r--r-- | libs/hwui/renderstate/Stencil.cpp | 13 | ||||
-rw-r--r-- | libs/hwui/renderstate/Stencil.h | 5 |
3 files changed, 11 insertions, 9 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 30935d5..f1ec8ae 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1262,7 +1262,7 @@ void OpenGLRenderer::attachStencilBufferToLayer(Layer* layer) { endTiling(); RenderBuffer* buffer = mCaches.renderBufferCache.get( - Stencil::getSmallestStencilFormat(), + Stencil::getLayerStencilFormat(), layer->getWidth(), layer->getHeight()); layer->setStencilRenderBuffer(buffer); diff --git a/libs/hwui/renderstate/Stencil.cpp b/libs/hwui/renderstate/Stencil.cpp index cedb233..92a057d 100644 --- a/libs/hwui/renderstate/Stencil.cpp +++ b/libs/hwui/renderstate/Stencil.cpp @@ -42,12 +42,17 @@ uint8_t Stencil::getStencilSize() { return STENCIL_BUFFER_SIZE; } -GLenum Stencil::getSmallestStencilFormat() { +/** + * This method will return either GL_STENCIL_INDEX4_OES if supported, + * GL_STENCIL_INDEX8 if not. + * + * Layers can't use a single bit stencil because multi-rect ClipArea needs a high enough + * stencil resolution to represent the summation of multiple intersecting rect geometries. + */ +GLenum Stencil::getLayerStencilFormat() { #if !DEBUG_STENCIL const Extensions& extensions = Caches::getInstance().extensions(); - if (extensions.has1BitStencil()) { - return GL_STENCIL_INDEX1_OES; - } else if (extensions.has4BitStencil()) { + if (extensions.has4BitStencil()) { return GL_STENCIL_INDEX4_OES; } #endif diff --git a/libs/hwui/renderstate/Stencil.h b/libs/hwui/renderstate/Stencil.h index e4f0f3f..3a8f8eb 100644 --- a/libs/hwui/renderstate/Stencil.h +++ b/libs/hwui/renderstate/Stencil.h @@ -42,10 +42,7 @@ public: */ ANDROID_API static uint8_t getStencilSize(); - /** - * Returns the smallest stencil format accepted by render buffers. - */ - static GLenum getSmallestStencilFormat(); + static GLenum getLayerStencilFormat(); /** * Clears the stencil buffer. |