diff options
author | Ian Romanick <idr@us.ibm.com> | 2005-08-13 01:43:28 +0000 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2005-08-13 01:43:28 +0000 |
commit | 33f9c98aa6643abe587f71976db51d4138ccc2b9 (patch) | |
tree | 11b4a76e561ac76314c235fb9eca078f354bca40 /src | |
parent | 6fe7a0dc01887e39f028d8d400b98d199744c18f (diff) |
Enable support for EXT_stencil_wrap. The code was already there, but the
extension wasn't enabled. I have verified its correct function with Mesa's
stencil_wrap test. It is enabled on both Savage4 and Savage3D. Since
Savage3D uses a software fallback for *all* stencil operations, this is safe.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/savage/savage_bci.h | 44 | ||||
-rw-r--r-- | src/mesa/drivers/dri/savage/savage_xmesa.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/savage/savagestate.c | 117 |
3 files changed, 37 insertions, 125 deletions
diff --git a/src/mesa/drivers/dri/savage/savage_bci.h b/src/mesa/drivers/dri/savage/savage_bci.h index 591235c4bd..33cfac32c7 100644 --- a/src/mesa/drivers/dri/savage/savage_bci.h +++ b/src/mesa/drivers/dri/savage/savage_bci.h @@ -431,43 +431,17 @@ typedef enum * stencil control */ -typedef ZCmpFunc SCmpFunc; - -typedef enum -{ - STC_FAIL_Keep, - STC_FAIL_Zero, - STC_FAIL_Equal, - STC_FAIL_IncClamp, - STC_FAIL_DecClamp, - STC_FAIL_Invert, - STC_FAIL_Inc, - STC_FAIL_Dec -} StencilFailOp; - -typedef enum -{ - STC_ZPASS_Keep, - STC_ZPASS_Zero, - STC_ZPASS_Equal, - STC_ZPASS_IncClamp, - STC_ZPASS_DecClamp, - STC_ZPASS_Invert, - STC_ZPASS_Inc, - STC_ZPASS_Dec -} StencilZPassOp; - typedef enum { - STC_ZFAIL_Keep, - STC_ZFAIL_Zero, - STC_ZFAIL_Equal, - STC_ZFAIL_IncClamp, - STC_ZFAIL_DecClamp, - STC_ZFAIL_Invert, - STC_ZFAIL_Inc, - STC_ZFAIL_Dec -} StencilZFailOp; + STENCIL_Keep, + STENCIL_Zero, + STENCIL_Equal, + STENCIL_IncClamp, + STENCIL_DecClamp, + STENCIL_Invert, + STENCIL_Inc, + STENCIL_Dec +} StencilOp; /*************************************************************** *** Bitfield Structures for Programming Interface ************** diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index fa20d10edb..d57b2c52d4 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -133,6 +133,7 @@ static const struct dri_extension card_extensions[] = { "GL_ARB_multisample", GL_ARB_multisample_functions }, { "GL_ARB_multitexture", NULL }, { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, + { "GL_EXT_stencil_wrap", NULL }, { "GL_EXT_texture_lod_bias", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index 567b979733..996d5b9171 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -1001,9 +1001,9 @@ static void savageDDStencilFunc(GLcontext *ctx, GLenum func, GLint ref, GLuint mask) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); - SCmpFunc a=0; - u_int32_t zBufCtrl = imesa->regs.s4.zBufCtrl.ui; - u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui; + unsigned a=0; + const u_int32_t zBufCtrl = imesa->regs.s4.zBufCtrl.ui; + const u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui; imesa->regs.s4.zBufCtrl.ni.stencilRefVal = ctx->Stencil.Ref[0]; imesa->regs.s4.stencilCtrl.ni.readMask = ctx->Stencil.ValueMask[0]; @@ -1039,96 +1039,33 @@ static void savageDDStencilMask(GLcontext *ctx, GLuint mask) } } -static void savageDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail, - GLenum zpass) +static unsigned get_stencil_op_value( GLenum op ) { - savageContextPtr imesa = SAVAGE_CONTEXT(ctx); - u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui; - - switch (ctx->Stencil.FailFunc[0]) + switch (op) { - case GL_KEEP: - imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Keep; - break; - case GL_ZERO: - imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Zero; - break; - case GL_REPLACE: - imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Equal; - break; - case GL_INCR: - imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_IncClamp; - break; - case GL_DECR: - imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_DecClamp; - break; - case GL_INVERT: - imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Invert; - break; - case GL_INCR_WRAP_EXT: - imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Inc; - break; - case GL_DECR_WRAP_EXT: - imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Dec; - break; + case GL_KEEP: return STENCIL_Keep; + case GL_ZERO: return STENCIL_Zero; + case GL_REPLACE: return STENCIL_Equal; + case GL_INCR: return STENCIL_IncClamp; + case GL_DECR: return STENCIL_DecClamp; + case GL_INVERT: return STENCIL_Invert; + case GL_INCR_WRAP: return STENCIL_Inc; + case GL_DECR_WRAP: return STENCIL_Dec; } + /* Should *never* get here. */ + return STENCIL_Keep; +} - switch (ctx->Stencil.ZFailFunc[0]) - { - case GL_KEEP: - imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Keep; - break; - case GL_ZERO: - imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Zero; - break; - case GL_REPLACE: - imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Equal; - break; - case GL_INCR: - imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_IncClamp; - break; - case GL_DECR: - imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_DecClamp; - break; - case GL_INVERT: - imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Invert; - break; - case GL_INCR_WRAP_EXT: - imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Inc; - break; - case GL_DECR_WRAP_EXT: - imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Dec; - break; - } +static void savageDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail, + GLenum zpass) +{ + savageContextPtr imesa = SAVAGE_CONTEXT(ctx); + const u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui; - switch (ctx->Stencil.ZPassFunc[0]) - { - case GL_KEEP: - imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Keep; - break; - case GL_ZERO: - imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Zero; - break; - case GL_REPLACE: - imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Equal; - break; - case GL_INCR: - imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_IncClamp; - break; - case GL_DECR: - imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_DecClamp; - break; - case GL_INVERT: - imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Invert; - break; - case GL_INCR_WRAP_EXT: - imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Inc; - break; - case GL_DECR_WRAP_EXT: - imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Dec; - break; - } + imesa->regs.s4.stencilCtrl.ni.failOp = get_stencil_op_value( ctx->Stencil.FailFunc[0] ); + imesa->regs.s4.stencilCtrl.ni.passZfailOp = get_stencil_op_value( ctx->Stencil.ZFailFunc[0] ); + imesa->regs.s4.stencilCtrl.ni.passZpassOp = get_stencil_op_value( ctx->Stencil.ZPassFunc[0] ); if (stencilCtrl != imesa->regs.s4.stencilCtrl.ui) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; @@ -1586,9 +1523,9 @@ static void savageDDInitState_s4( savageContextPtr imesa ) imesa->regs.s4.stencilCtrl.ni.stencilEn = GL_FALSE; imesa->regs.s4.stencilCtrl.ni.cmpFunc = CF_Always; - imesa->regs.s4.stencilCtrl.ni.failOp = STC_FAIL_Keep; - imesa->regs.s4.stencilCtrl.ni.passZfailOp = STC_FAIL_Keep; - imesa->regs.s4.stencilCtrl.ni.passZpassOp = STC_FAIL_Keep; + imesa->regs.s4.stencilCtrl.ni.failOp = STENCIL_Keep; + imesa->regs.s4.stencilCtrl.ni.passZfailOp = STENCIL_Keep; + imesa->regs.s4.stencilCtrl.ni.passZpassOp = STENCIL_Keep; imesa->regs.s4.stencilCtrl.ni.writeMask = 0xff; imesa->regs.s4.stencilCtrl.ni.readMask = 0xff; |