diff options
author | Chris Craik <ccraik@google.com> | 2015-07-30 11:05:16 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-07-30 11:06:53 -0700 |
commit | fa51a0e1ceb496e57f6c234800a3f5e9a2d89142 (patch) | |
tree | bf40c052cfa1baa141d5a8a6b9c6c30a248e2dfc /libs/hwui | |
parent | b83b5fa641847ee1d533253ba5e1a3e13913b9d9 (diff) | |
download | frameworks_base-fa51a0e1ceb496e57f6c234800a3f5e9a2d89142.zip frameworks_base-fa51a0e1ceb496e57f6c234800a3f5e9a2d89142.tar.gz frameworks_base-fa51a0e1ceb496e57f6c234800a3f5e9a2d89142.tar.bz2 |
Fix stencil mask usage in HWUI
bug:21588246
Ensure we always set the mask before clearing, and removes
some unneeded optimizations around mask usage in
debug (overdraw) mode.
Change-Id: I71ed06c16f8d9f158953d5aa160098514f0f7f00
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/renderstate/Stencil.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libs/hwui/renderstate/Stencil.cpp b/libs/hwui/renderstate/Stencil.cpp index 92a057d..319cfe4 100644 --- a/libs/hwui/renderstate/Stencil.cpp +++ b/libs/hwui/renderstate/Stencil.cpp @@ -60,8 +60,14 @@ GLenum Stencil::getLayerStencilFormat() { } void Stencil::clear() { + glStencilMask(0xff); glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); + + if (mState == kTest) { + // reset to test state, with immutable stencil + glStencilMask(0); + } } void Stencil::enableTest(int incrementThreshold) { @@ -104,17 +110,17 @@ void Stencil::enableDebugTest(GLint value, bool greater) { // We only want to test, let's keep everything glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); mState = kTest; + glStencilMask(0); } void Stencil::enableDebugWrite() { - if (mState != kWrite) { - enable(); - glStencilFunc(GL_ALWAYS, 0x1, 0xffffffff); - // The test always passes so the first two values are meaningless - glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - mState = kWrite; - } + enable(); + glStencilFunc(GL_ALWAYS, 0x1, 0xffffffff); + // The test always passes so the first two values are meaningless + glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + mState = kWrite; + glStencilMask(0xff); } void Stencil::enable() { |