summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXiang, Haihao <[email protected]>2007-09-18 09:32:44 +0800
committerXiang, Haihao <[email protected]>2007-09-18 09:32:44 +0800
commite21d2c6ef300c7661f49c50b4c68b4f205795f4a (patch)
treed60ad5b663caedd6e574ff8f1f0c6a2c37c7d11d /src
parentc29886718ac8389b526b3eb5947c286b7fe00a88 (diff)
mesa: Always use the original mask to update stencil buffer
in stencil_and_ztest_pixels. fix #12263
Diffstat (limited to 'src')
-rw-r--r--src/mesa/swrast/s_stencil.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index d0cbdd6917d..cae1e09929b 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/src/mesa/swrast/s_stencil.c
@@ -923,6 +923,8 @@ stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face )
ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
_swrast_get_values(ctx, rb, n, x, y, stencil, sizeof(GLubyte));
+ _mesa_memcpy(origMask, mask, n * sizeof(GLubyte));
+
(void) do_stencil_test(ctx, face, n, stencil, mask);
if (ctx->Depth.Test == GL_FALSE) {
@@ -930,11 +932,12 @@ stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face )
n, stencil, mask);
}
else {
- _mesa_memcpy(origMask, mask, n * sizeof(GLubyte));
+ GLubyte tmpMask[MAX_WIDTH];
+ _mesa_memcpy(tmpMask, mask, n * sizeof(GLubyte));
_swrast_depth_test_span(ctx, span);
- compute_pass_fail_masks(n, origMask, mask, passMask, failMask);
+ compute_pass_fail_masks(n, tmpMask, mask, passMask, failMask);
if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) {
apply_stencil_op(ctx, ctx->Stencil.ZFailFunc[face], face,