diff options
author | Brian <[email protected]> | 2007-07-11 09:52:32 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-07-11 09:52:32 -0600 |
commit | d6aa360eddec0463f3563eff07b06c5d60037826 (patch) | |
tree | 257bd7fc97d899b69ec92366b207e0bf112436ae /src/mesa | |
parent | 0ac0fb91bd711ec80a058ab23bfe8011baa0a487 (diff) |
fix stencil logic error, use proper front/back face value
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_quad_stencil.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_stencil.c b/src/mesa/pipe/softpipe/sp_quad_stencil.c index 5b59addce24..0b37474c1a8 100644 --- a/src/mesa/pipe/softpipe/sp_quad_stencil.c +++ b/src/mesa/pipe/softpipe/sp_quad_stencil.c @@ -203,12 +203,12 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad) struct softpipe_context *softpipe = qs->softpipe; struct softpipe_surface *s_surf = softpipe_surface(softpipe->framebuffer.sbuf); GLuint func, zFailOp, zPassOp, failOp; - GLuint face = 0; GLubyte ref, wrtMask, valMask; GLubyte stencilVals[QUAD_SIZE]; /* choose front or back face function, operator, etc */ - if (softpipe->stencil.back_enabled && face == 1) { + /* XXX we could do these initializations once per primitive */ + if (softpipe->stencil.back_enabled && quad->facing) { func = softpipe->stencil.back_func; failOp = softpipe->stencil.back_fail_op; zFailOp = softpipe->stencil.back_zfail_op; @@ -242,29 +242,30 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad) } } - if (!quad->mask) - return; + if (quad->mask) { - /* now the pixels that passed the stencil test are depth tested */ - if (softpipe->depth_test.enabled) { - const GLbitfield origMask = quad->mask; + /* now the pixels that passed the stencil test are depth tested */ + if (softpipe->depth_test.enabled) { + const GLbitfield origMask = quad->mask; - sp_depth_test_quad(qs, quad); /* quad->mask is updated */ + sp_depth_test_quad(qs, quad); /* quad->mask is updated */ - /* update stencil buffer values according to z pass/fail result */ - if (zFailOp != PIPE_STENCIL_OP_KEEP) { - const GLbitfield failMask = origMask & ~quad->mask; - apply_stencil_op(stencilVals, failMask, zFailOp, ref, wrtMask); - } + /* update stencil buffer values according to z pass/fail result */ + if (zFailOp != PIPE_STENCIL_OP_KEEP) { + const GLbitfield failMask = origMask & ~quad->mask; + apply_stencil_op(stencilVals, failMask, zFailOp, ref, wrtMask); + } - if (zPassOp != PIPE_STENCIL_OP_KEEP) { - const GLbitfield passMask = origMask & quad->mask; - apply_stencil_op(stencilVals, passMask, zPassOp, ref, wrtMask); + if (zPassOp != PIPE_STENCIL_OP_KEEP) { + const GLbitfield passMask = origMask & quad->mask; + apply_stencil_op(stencilVals, passMask, zPassOp, ref, wrtMask); + } } - } - else { - /* no depth test, apply Zpass operator to stencil buffer values */ - apply_stencil_op(stencilVals, quad->mask, zPassOp, ref, wrtMask); + else { + /* no depth test, apply Zpass operator to stencil buffer values */ + apply_stencil_op(stencilVals, quad->mask, zPassOp, ref, wrtMask); + } + } s_surf->write_quad_stencil(s_surf, quad->x0, quad->y0, stencilVals); |