summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2013-04-02 10:22:18 -0700
committerIan Romanick <[email protected]>2013-05-10 16:41:28 -0700
commitae79402dba2ad2c6573ffb67c7f280f00291addd (patch)
tree0c5bc8e79c280b8f13e1a136d7cc74407c94ed0b /src/mesa
parent2708dc5e880ea3e25a2dec7490335a27d0cbadab (diff)
mesa: Add new ctx->Stencil._WriteEnabled derived state flag.
i965 needs to know whether stencil writes are enabled in several places, and gets the test wrong sometimes. While we could create a function to compute this, it seems generally useful enough to warrant a new piece of derived state. Also, all the plumbing is already in place. NOTE: This is a candidate for stable branches. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]> (cherry picked from commit 1e3235d36e45ee7565d322971dfa179f48d79767)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/stencil.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8f906aeedf5..df914184f6f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1128,6 +1128,7 @@ struct gl_stencil_attrib
GLboolean TestTwoSide; /**< GL_EXT_stencil_two_side */
GLubyte ActiveFace; /**< GL_EXT_stencil_two_side (0 or 2) */
GLboolean _Enabled; /**< Enabled and stencil buffer present */
+ GLboolean _WriteEnabled; /**< _Enabled and non-zero writemasks */
GLboolean _TestTwoSide;
GLubyte _BackFace; /**< Current back stencil state (1 or 2) */
GLenum Function[3]; /**< Stencil function */
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index c161808e58a..33084173138 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -551,6 +551,11 @@ _mesa_update_stencil(struct gl_context *ctx)
ctx->Stencil.Ref[0] != ctx->Stencil.Ref[face] ||
ctx->Stencil.ValueMask[0] != ctx->Stencil.ValueMask[face] ||
ctx->Stencil.WriteMask[0] != ctx->Stencil.WriteMask[face]);
+
+ ctx->Stencil._WriteEnabled =
+ ctx->Stencil._Enabled &&
+ (ctx->Stencil.WriteMask[0] != 0 ||
+ (ctx->Stencil._TestTwoSide && ctx->Stencil.WriteMask[face] != 0));
}