summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2015-07-30 19:51:38 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2015-07-30 19:51:38 +0000
commit9c458148e9c113ee7092f05ede90a71a64a01adb (patch)
tree071b03ed0c3412e3a0fe680a5faee2d3626a2a5a
parent124eb8dc36ff6f6a33b9e40a402808da7ecf487c (diff)
parent3d208671164a6f71391228bd7ce618f76901b103 (diff)
am 3d208671: am 7dfb1d99: am 730c0f65: Merge "Fix stencil mask usage in HWUI" into mnc-dev
* commit '3d208671164a6f71391228bd7ce618f76901b103': Fix stencil mask usage in HWUI
-rw-r--r--libs/hwui/renderstate/Stencil.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/libs/hwui/renderstate/Stencil.cpp b/libs/hwui/renderstate/Stencil.cpp
index 92a057d92c5d..319cfe4ba0d0 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() {