X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_stencil.c;h=e9e9d3a4f10eccb88e63d19008d4356b42eb8acb;hb=940ca2e837efe45caae1cf1d9665f6736347705d;hp=cdb7e4669cefd2a47629c5dfc95418e2f8db8d69;hpb=101d1a658a614d1e2ec02b1e697f6161291af653;p=mesa.git diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c index cdb7e4669ce..e9e9d3a4f10 100644 --- a/src/mesa/swrast/s_stencil.c +++ b/src/mesa/swrast/s_stencil.c @@ -231,8 +231,9 @@ do_stencil_test( GLcontext *ctx, GLuint face, GLuint n, GLstencil stencil[], GLubyte fail[MAX_WIDTH]; GLboolean allfail = GL_FALSE; GLuint i; - GLstencil r, s; const GLuint valueMask = ctx->Stencil.ValueMask[face]; + const GLstencil r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); + GLstencil s; ASSERT(n <= MAX_WIDTH); @@ -260,7 +261,6 @@ do_stencil_test( GLcontext *ctx, GLuint face, GLuint n, GLstencil stencil[], allfail = GL_TRUE; break; case GL_LESS: - r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iDataType == 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 +927,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, @@ -994,10 +992,12 @@ stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face ) GLboolean _swrast_stencil_and_ztest_span(GLcontext *ctx, SWspan *span) { + const GLuint face = (span->facing == 0) ? 0 : ctx->Stencil._BackFace; + if (span->arrayMask & SPAN_XY) - return stencil_and_ztest_pixels(ctx, span, span->facing); + return stencil_and_ztest_pixels(ctx, span, face); else - return stencil_and_ztest_span(ctx, span, span->facing); + return stencil_and_ztest_span(ctx, span, face); }