diff options
Diffstat (limited to 'src/mesa/main/stencil.h')
-rw-r--r-- | src/mesa/main/stencil.h | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h index ccb86469189..dc371ec36cd 100644 --- a/src/mesa/main/stencil.h +++ b/src/mesa/main/stencil.h @@ -86,11 +86,6 @@ _mesa_StencilMaskSeparate_no_error(GLenum face, GLuint mask); 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 ); @@ -108,4 +103,35 @@ _mesa_get_stencil_ref(struct gl_context const *ctx, int face) 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 |