diff options
-rw-r--r-- | src/mesa/main/mtypes.h | 1 | ||||
-rw-r--r-- | src/mesa/main/stencil.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 355933d189..b305d53966 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1130,6 +1130,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 f47b57b8df..7819cb3968 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -564,6 +564,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)); } |