diff options
author | Daniel Borca <[email protected]> | 2004-12-21 08:21:52 +0000 |
---|---|---|
committer | Daniel Borca <[email protected]> | 2004-12-21 08:21:52 +0000 |
commit | 91a04617c40a740ade27e2f60e78a761a297a1d3 (patch) | |
tree | 28af13a83dd9bccdd6be93763729567b9c52ce89 /src/mesa/drivers/glide/fxsetup.c | |
parent | d7b9d6046d0cca704c712ebb8823b78dc06f9bf5 (diff) |
added GL_EXT_stencil_two_side (yes, it works)
Diffstat (limited to 'src/mesa/drivers/glide/fxsetup.c')
-rw-r--r-- | src/mesa/drivers/glide/fxsetup.c | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index dd8a383e24d..ee945dc886f 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -1686,6 +1686,10 @@ fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask) fxMesaContext fxMesa = FX_CONTEXT(ctx); tfxUnitsState *us = &fxMesa->unitsState; + if (ctx->Stencil.ActiveFace) { + return; + } + if ( (us->stencilFunction != func) || @@ -1706,6 +1710,10 @@ fxDDStencilMask (GLcontext *ctx, GLuint mask) fxMesaContext fxMesa = FX_CONTEXT(ctx); tfxUnitsState *us = &fxMesa->unitsState; + if (ctx->Stencil.ActiveFace) { + return; + } + if (us->stencilWriteMask != mask) { us->stencilWriteMask = mask; fxMesa->new_state |= FX_NEW_STENCIL; @@ -1718,6 +1726,10 @@ fxDDStencilOp (GLcontext *ctx, GLenum sfail, GLenum zfail, GLenum zpass) fxMesaContext fxMesa = FX_CONTEXT(ctx); tfxUnitsState *us = &fxMesa->unitsState; + if (ctx->Stencil.ActiveFace) { + return; + } + if ( (us->stencilFailFunc != sfail) || @@ -1739,10 +1751,18 @@ fxSetupStencil (GLcontext * ctx) tfxUnitsState *us = &fxMesa->unitsState; if (us->stencilEnabled) { + GrCmpFnc_t stencilFailFunc = GR_STENCILOP_KEEP; + GrCmpFnc_t stencilZFailFunc = GR_STENCILOP_KEEP; + GrCmpFnc_t stencilZPassFunc = GR_STENCILOP_KEEP; + if (!fxMesa->multipass) { + stencilFailFunc = convertGLStencilOp(us->stencilFailFunc); + stencilZFailFunc = convertGLStencilOp(us->stencilZFailFunc); + stencilZPassFunc = convertGLStencilOp(us->stencilZPassFunc); + } grEnable(GR_STENCIL_MODE_EXT); - fxMesa->Glide.grStencilOpExt(convertGLStencilOp(us->stencilFailFunc), - convertGLStencilOp(us->stencilZFailFunc), - convertGLStencilOp(us->stencilZPassFunc)); + fxMesa->Glide.grStencilOpExt(stencilFailFunc, + stencilZFailFunc, + stencilZPassFunc); fxMesa->Glide.grStencilFuncExt(us->stencilFunction - GL_NEVER + GR_CMP_NEVER, us->stencilRefValue, us->stencilValueMask); @@ -1752,6 +1772,34 @@ fxSetupStencil (GLcontext * ctx) } } +void +fxSetupStencilFace (GLcontext * ctx, GLint face) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxUnitsState *us = &fxMesa->unitsState; + + if (us->stencilEnabled) { + GrCmpFnc_t stencilFailFunc = GR_STENCILOP_KEEP; + GrCmpFnc_t stencilZFailFunc = GR_STENCILOP_KEEP; + GrCmpFnc_t stencilZPassFunc = GR_STENCILOP_KEEP; + if (!fxMesa->multipass) { + stencilFailFunc = convertGLStencilOp(ctx->Stencil.FailFunc[face]); + stencilZFailFunc = convertGLStencilOp(ctx->Stencil.ZFailFunc[face]); + stencilZPassFunc = convertGLStencilOp(ctx->Stencil.ZPassFunc[face]); + } + grEnable(GR_STENCIL_MODE_EXT); + fxMesa->Glide.grStencilOpExt(stencilFailFunc, + stencilZFailFunc, + stencilZPassFunc); + fxMesa->Glide.grStencilFuncExt(ctx->Stencil.Function[face] - GL_NEVER + GR_CMP_NEVER, + ctx->Stencil.Ref[face], + ctx->Stencil.ValueMask[face]); + fxMesa->Glide.grStencilMaskExt(ctx->Stencil.WriteMask[face]); + } else { + grDisable(GR_STENCIL_MODE_EXT); + } +} + /************************************************************************/ /**************************** Color Mask SetUp **************************/ /************************************************************************/ |