diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/mtypes.h | 3 | ||||
-rw-r--r-- | src/mesa/main/state.c | 3 | ||||
-rw-r--r-- | src/mesa/main/stencil.c | 28 | ||||
-rw-r--r-- | src/mesa/main/stencil.h | 36 |
4 files changed, 31 insertions, 39 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 65f638b89e6..8872c38a02b 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -856,9 +856,6 @@ struct gl_stencil_attrib GLboolean Enabled; /**< Enabled flag */ 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 */ GLenum FailFunc[3]; /**< Fail function */ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index b7e165fab62..d1d0c2cd998 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -379,9 +379,6 @@ _mesa_update_state_locked( struct gl_context *ctx ) if (new_state & (_NEW_LIGHT | _NEW_PROGRAM)) update_twoside( ctx ); - if (new_state & (_NEW_STENCIL | _NEW_BUFFERS)) - _mesa_update_stencil( ctx ); - if (new_state & _NEW_PIXEL) _mesa_update_pixel( ctx ); diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 4bd7b8803ef..612ad38dcc1 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -607,34 +607,6 @@ _mesa_StencilMaskSeparate(GLenum face, GLuint mask) /** - * Update derived stencil state. - */ -void -_mesa_update_stencil(struct gl_context *ctx) -{ - const GLint face = ctx->Stencil._BackFace; - - ctx->Stencil._Enabled = (ctx->Stencil.Enabled && - ctx->DrawBuffer->Visual.stencilBits > 0); - - ctx->Stencil._TestTwoSide = - ctx->Stencil._Enabled && - (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]); - - ctx->Stencil._WriteEnabled = - ctx->Stencil._Enabled && - (ctx->Stencil.WriteMask[0] != 0 || - (ctx->Stencil._TestTwoSide && ctx->Stencil.WriteMask[face] != 0)); -} - - -/** * Initialize the context stipple state. * * \param ctx GL context. 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 |