summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-12-28 14:18:18 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-01 10:21:21 -0700
commitc37d2c9325a39287e29c22ab0e6838e7e35c7175 (patch)
treea7ee86d411cb5f060fbc74489c8d2b2be222f8ce /src/mesa
parent6656864135411d379c06e071c5a5e73b4e4baea5 (diff)
fix single-sided stencil test bug
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stencil.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_stencil.c b/src/mesa/pipe/softpipe/sp_quad_stencil.c
index a688a06c74..33740883d3 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stencil.c
+++ b/src/mesa/pipe/softpipe/sp_quad_stencil.c
@@ -208,16 +208,22 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
struct softpipe_cached_tile *tile
= sp_get_cached_tile(softpipe, softpipe->sbuf_cache, quad->x0, quad->y0);
uint j;
+ uint face = quad->facing;
+
+ if (!softpipe->depth_stencil->stencil[1].enabled) {
+ /* single-sided stencil test, use front (face=0) state */
+ face = 0;
+ }
/* choose front or back face function, operator, etc */
/* XXX we could do these initializations once per primitive */
- func = softpipe->depth_stencil->stencil[quad->facing].func;
- failOp = softpipe->depth_stencil->stencil[quad->facing].fail_op;
- zFailOp = softpipe->depth_stencil->stencil[quad->facing].zfail_op;
- zPassOp = softpipe->depth_stencil->stencil[quad->facing].zpass_op;
- ref = softpipe->depth_stencil->stencil[quad->facing].ref_value;
- wrtMask = softpipe->depth_stencil->stencil[quad->facing].write_mask;
- valMask = softpipe->depth_stencil->stencil[quad->facing].value_mask;
+ func = softpipe->depth_stencil->stencil[face].func;
+ failOp = softpipe->depth_stencil->stencil[face].fail_op;
+ zFailOp = softpipe->depth_stencil->stencil[face].zfail_op;
+ zPassOp = softpipe->depth_stencil->stencil[face].zpass_op;
+ ref = softpipe->depth_stencil->stencil[face].ref_value;
+ wrtMask = softpipe->depth_stencil->stencil[face].write_mask;
+ valMask = softpipe->depth_stencil->stencil[face].value_mask;
assert(ps); /* shouldn't get here if there's no stencil buffer */