extern void GLAPIENTRY
_mesa_StencilMaskSeparate(GLenum face, GLuint mask);
-
-extern void
-_mesa_update_stencil(struct gl_context *ctx);
-
-
extern void
_mesa_init_stencil( struct gl_context * ctx );
return CLAMP(ref, 0, stencilMax);
}
+static inline bool
+_mesa_stencil_is_enabled(const struct gl_context *ctx)
+{
+ return ctx->Stencil.Enabled &&
+ ctx->DrawBuffer->Visual.stencilBits > 0;
+}
+
+static inline bool
+_mesa_stencil_is_two_sided(const struct gl_context *ctx)
+{
+ const int face = ctx->Stencil._BackFace;
+
+ return _mesa_stencil_is_enabled(ctx) &&
+ (ctx->Stencil.Function[0] != ctx->Stencil.Function[face] ||
+ ctx->Stencil.FailFunc[0] != ctx->Stencil.FailFunc[face] ||
+ ctx->Stencil.ZPassFunc[0] != ctx->Stencil.ZPassFunc[face] ||
+ ctx->Stencil.ZFailFunc[0] != ctx->Stencil.ZFailFunc[face] ||
+ ctx->Stencil.Ref[0] != ctx->Stencil.Ref[face] ||
+ ctx->Stencil.ValueMask[0] != ctx->Stencil.ValueMask[face] ||
+ ctx->Stencil.WriteMask[0] != ctx->Stencil.WriteMask[face]);
+}
+
+static inline bool
+_mesa_stencil_is_write_enabled(const struct gl_context *ctx, bool is_two_sided)
+{
+ return _mesa_stencil_is_enabled(ctx) &&
+ (ctx->Stencil.WriteMask[0] != 0 ||
+ (is_two_sided &&
+ ctx->Stencil.WriteMask[ctx->Stencil._BackFace] != 0));
+}
+
#endif