From 71b2504e0390fa19f133647c8686d830f8f40eb6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 8 May 2006 09:03:35 +0000 Subject: [PATCH] updates to dri drivers for recent stencil changes --- src/mesa/drivers/dri/i915/intel_ioctl.c | 2 +- src/mesa/drivers/dri/r128/r128_state.c | 12 +++++----- src/mesa/drivers/dri/r200/r200_state.c | 10 ++++---- src/mesa/drivers/dri/r300/r300_state.c | 10 ++++---- src/mesa/drivers/dri/radeon/radeon_state.c | 10 ++++---- src/mesa/drivers/dri/savage/savagestate.c | 8 +++---- src/mesa/drivers/dri/sis/sis_clear.c | 7 +++--- src/mesa/drivers/dri/sis/sis_state.c | 2 +- src/mesa/drivers/dri/sis/sis_stencil.c | 5 ++-- src/mesa/drivers/dri/tdfx/tdfx_render.c | 28 +++++++++++----------- src/mesa/drivers/dri/tdfx/tdfx_state.c | 6 ++--- src/mesa/drivers/dri/unichrome/via_ioctl.c | 2 +- 12 files changed, 52 insertions(+), 50 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c index 4f570c0e0fa..d8530367664 100644 --- a/src/mesa/drivers/dri/i915/intel_ioctl.c +++ b/src/mesa/drivers/dri/i915/intel_ioctl.c @@ -418,7 +418,7 @@ void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean all, if (!intel->hw_stencil) { swrast_mask |= BUFFER_BIT_STENCIL; } - else if (ctx->Stencil.WriteMask[0] != ~0U) { + else if ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff) { tri_mask |= BUFFER_BIT_STENCIL; } else { diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index e9149306d87..1b2c2a5284e 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -260,9 +260,9 @@ r128DDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); - GLuint refmask = ((ctx->Stencil.Ref[0] << 0) | - (ctx->Stencil.ValueMask[0] << 16) | - (ctx->Stencil.WriteMask[0] << 24)); + GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << 0) | + ((ctx->Stencil.ValueMask[0] & 0xff) << 16) | + ((ctx->Stencil.WriteMask[0] & 0xff) << 24)); GLuint z = rmesa->setup.z_sten_cntl_c; z &= ~R128_STENCIL_TEST_MASK; @@ -307,9 +307,9 @@ static void r128DDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); - GLuint refmask = ((ctx->Stencil.Ref[0] << 0) | - (ctx->Stencil.ValueMask[0] << 16) | - (ctx->Stencil.WriteMask[0] << 24)); + GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << 0) | + ((ctx->Stencil.ValueMask[0] & 0xff) << 16) | + ((ctx->Stencil.WriteMask[0] & 0xff) << 24)); if ( rmesa->setup.sten_ref_mask_c != refmask ) { rmesa->setup.sten_ref_mask_c = refmask; diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 43ae7b66780..6ffb48c1505 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -1452,8 +1452,8 @@ r200StencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - GLuint refmask = ((ctx->Stencil.Ref[0] << R200_STENCIL_REF_SHIFT) | - (ctx->Stencil.ValueMask[0] << R200_STENCIL_MASK_SHIFT)); + GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << R200_STENCIL_REF_SHIFT) | + ((ctx->Stencil.ValueMask[0] & 0xff) << R200_STENCIL_MASK_SHIFT)); R200_STATECHANGE( rmesa, ctx ); R200_STATECHANGE( rmesa, msk ); @@ -1500,7 +1500,7 @@ r200StencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) R200_STATECHANGE( rmesa, msk ); rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~R200_STENCIL_WRITE_MASK; rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |= - (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT); + ((ctx->Stencil.WriteMask[0] & 0xff) << R200_STENCIL_WRITEMASK_SHIFT); } static void @@ -1601,9 +1601,9 @@ static void r200ClearStencil( GLcontext *ctx, GLint s ) r200ContextPtr rmesa = R200_CONTEXT(ctx); rmesa->state.stencil.clear = - ((GLuint) ctx->Stencil.Clear | + ((GLuint) (ctx->Stencil.Clear & 0xff) | (0xff << R200_STENCIL_MASK_SHIFT) | - (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT)); + ((ctx->Stencil.WriteMask[0] & 0xff) << R200_STENCIL_WRITEMASK_SHIFT)); } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index ae0d2715210..70d42c2ea3b 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -863,8 +863,8 @@ static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - GLuint refmask = ((ctx->Stencil.Ref[0] << R300_RB3D_ZS2_STENCIL_REF_SHIFT) | - (ctx->Stencil.ValueMask[0] << R300_RB3D_ZS2_STENCIL_MASK_SHIFT)); + GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << R300_RB3D_ZS2_STENCIL_REF_SHIFT) | + ((ctx->Stencil.ValueMask[0] & 0xff) << R300_RB3D_ZS2_STENCIL_MASK_SHIFT)); GLuint flag; @@ -890,7 +890,7 @@ static void r300StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) R300_STATECHANGE(rmesa, zs); rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= ~(R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT); - rmesa->hw.zs.cmd[R300_ZS_CNTL_2] |= ctx->Stencil.WriteMask[0] << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT; + rmesa->hw.zs.cmd[R300_ZS_CNTL_2] |= (ctx->Stencil.WriteMask[0] & 0xff) << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT; } @@ -920,9 +920,9 @@ static void r300ClearStencil(GLcontext * ctx, GLint s) r300ContextPtr rmesa = R300_CONTEXT(ctx); rmesa->state.stencil.clear = - ((GLuint) ctx->Stencil.Clear | + ((GLuint) (ctx->Stencil.Clear & 0xff) | (R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_MASK_SHIFT) | - (ctx->Stencil.WriteMask[0] << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT)); + ((ctx->Stencil.WriteMask[0] & 0xff) << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT)); } /* ============================================================= diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 447619b56d0..307c1f341b4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -1282,8 +1282,8 @@ radeonStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - GLuint refmask = ((ctx->Stencil.Ref[0] << RADEON_STENCIL_REF_SHIFT) | - (ctx->Stencil.ValueMask[0] << RADEON_STENCIL_MASK_SHIFT)); + GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << RADEON_STENCIL_REF_SHIFT) | + ((ctx->Stencil.ValueMask[0] & 0xff) << RADEON_STENCIL_MASK_SHIFT)); RADEON_STATECHANGE( rmesa, ctx ); RADEON_STATECHANGE( rmesa, msk ); @@ -1330,7 +1330,7 @@ radeonStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) RADEON_STATECHANGE( rmesa, msk ); rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~RADEON_STENCIL_WRITE_MASK; rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |= - (ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT); + ((ctx->Stencil.WriteMask[0] & 0xff) << RADEON_STENCIL_WRITEMASK_SHIFT); } static void radeonStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, @@ -1458,9 +1458,9 @@ static void radeonClearStencil( GLcontext *ctx, GLint s ) radeonContextPtr rmesa = RADEON_CONTEXT(ctx); rmesa->state.stencil.clear = - ((GLuint) ctx->Stencil.Clear | + ((GLuint) (ctx->Stencil.Clear & 0xff) | (0xff << RADEON_STENCIL_MASK_SHIFT) | - (ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT)); + ((ctx->Stencil.WriteMask[0] & 0xff) << RADEON_STENCIL_WRITEMASK_SHIFT)); } diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index 44cf2f20d37..3a267e025c9 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -986,8 +986,8 @@ savageDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, 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]; + imesa->regs.s4.zBufCtrl.ni.stencilRefVal = ctx->Stencil.Ref[0] & 0xff; + imesa->regs.s4.stencilCtrl.ni.readMask = ctx->Stencil.ValueMask[0] & 0xff; switch (ctx->Stencil.Function[0]) { @@ -1015,8 +1015,8 @@ savageDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); - if (imesa->regs.s4.stencilCtrl.ni.writeMask != ctx->Stencil.WriteMask[0]) { - imesa->regs.s4.stencilCtrl.ni.writeMask = ctx->Stencil.WriteMask[0]; + if (imesa->regs.s4.stencilCtrl.ni.writeMask != (ctx->Stencil.WriteMask[0] & 0xff)) { + imesa->regs.s4.stencilCtrl.ni.writeMask = (ctx->Stencil.WriteMask[0] & 0xff); imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } } diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c index d7807b157e9..637d502381e 100644 --- a/src/mesa/drivers/dri/sis/sis_clear.c +++ b/src/mesa/drivers/dri/sis/sis_clear.c @@ -133,7 +133,8 @@ sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all, if ((smesa->current.hwCapEnable2 & (MASK_AlphaMaskWriteEnable | MASK_ColorMaskWriteEnable) && (mask & (BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT)) != 0) || - (ctx->Stencil.WriteMask[0] < 0xff && (mask & BUFFER_BIT_STENCIL) != 0) ) + ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff && + (mask & BUFFER_BIT_STENCIL) != 0) ) { mask = sis_3D_Clear( ctx, mask, x1, y1, width1, height1 ); } @@ -213,13 +214,13 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask, if (bClrStencil) { dwSten1 = STENCIL_FORMAT_8 | SiS_STENCIL_ALWAYS | - (ctx->Stencil.Clear << 8) | 0xff; + ((ctx->Stencil.Clear & 0xff) << 8) | 0xff; dwSten2 = SiS_SFAIL_REPLACE | SiS_SPASS_ZFAIL_REPLACE | SiS_SPASS_ZPASS_REPLACE; dwEnable1 = MASK_ZWriteEnable | MASK_StencilWriteEnable | MASK_StencilTestEnable; dwEnable2 |= MASK_ZMaskWriteEnable; - dwDepthMask |= ctx->Stencil.WriteMask[0] << 24; + dwDepthMask |= (ctx->Stencil.WriteMask[0] & 0xff) << 24; } else if (bClrDepth) { dwEnable1 = MASK_ZWriteEnable; dwEnable2 |= MASK_ZMaskWriteEnable; diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c index 1a4c3241153..a30001c7462 100644 --- a/src/mesa/drivers/dri/sis/sis_state.c +++ b/src/mesa/drivers/dri/sis/sis_state.c @@ -251,7 +251,7 @@ sisDDDepthMask( GLcontext * ctx, GLboolean flag ) if (ctx->Visual.stencilBits) { if (flag || (ctx->Stencil.WriteMask[0] != 0)) { current->hwCapEnable |= MASK_ZWriteEnable; - if (flag && (ctx->Stencil.WriteMask[0] == 0xff)) { + if (flag && ((ctx->Stencil.WriteMask[0] & 0xff) == 0xff)) { current->hwCapEnable2 &= ~MASK_ZMaskWriteEnable; } else { current->hwCapEnable2 |= MASK_ZMaskWriteEnable; diff --git a/src/mesa/drivers/dri/sis/sis_stencil.c b/src/mesa/drivers/dri/sis/sis_stencil.c index 1febe86b94c..a1ce2966e89 100644 --- a/src/mesa/drivers/dri/sis/sis_stencil.c +++ b/src/mesa/drivers/dri/sis/sis_stencil.c @@ -45,8 +45,9 @@ sisDDStencilFuncSeparate( GLcontext * ctx, GLenum face, __GLSiSHardware *current = &smesa->current; /* set reference */ - current->hwStSetting = STENCIL_FORMAT_8 | (ctx->Stencil.Ref[0] << 8) | - ctx->Stencil.ValueMask[0]; + current->hwStSetting = (STENCIL_FORMAT_8 | + ((ctx->Stencil.Ref[0] & 0xff) << 8) | + (ctx->Stencil.ValueMask[0] & 0xff)); switch (func) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_render.c b/src/mesa/drivers/dri/tdfx/tdfx_render.c index 56f5f147eeb..a30ec78a558 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_render.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_render.c @@ -70,7 +70,7 @@ static void tdfxClear( GLcontext *ctx, mask &= ~(BUFFER_BIT_ACCUM); if (mask & BUFFER_BIT_STENCIL) { - if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask[0] != 0xff) { + if (!fxMesa->haveHwStencil || (ctx->Stencil.WriteMask[0] & 0xff) != 0xff) { /* Napalm seems to have trouble with stencil write masks != 0xff */ /* do stencil clear in software */ mask &= ~(BUFFER_BIT_STENCIL); @@ -98,7 +98,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grStencilMask(/*ctx->Stencil.WriteMask*/ 0xff); /* set stencil ref value = desired clear value */ fxMesa->Glide.grStencilFunc(GR_CMP_ALWAYS, - fxMesa->Stencil.Clear, 0xff); + (fxMesa->Stencil.Clear & 0xff), 0xff); fxMesa->Glide.grStencilOp(GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE); fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT); @@ -129,7 +129,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); } else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, @@ -152,11 +152,11 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, - fxMesa->Depth.Clear); + fxMesa->Depth.Clear & 0xff); /* clear front */ FX_grColorMaskv_NoLock(ctx, true4); fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER); @@ -164,7 +164,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, @@ -181,7 +181,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, @@ -198,7 +198,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, @@ -215,7 +215,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, @@ -225,7 +225,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, @@ -242,7 +242,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, @@ -254,7 +254,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, @@ -272,7 +272,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); else fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, @@ -293,7 +293,7 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear, - (FxU32) ctx->Stencil.Clear); + (FxU32) (ctx->Stencil.Clear & 0xff)); if (ctx->Depth.Mask && ctx->Depth.Test) { fxMesa->Glide.grDepthMask(FXTRUE); } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c index 1869de47374..a389273b2f0 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c @@ -462,9 +462,9 @@ static void tdfxUpdateStencil( GLcontext *ctx ) if (fxMesa->haveHwStencil) { if (ctx->Stencil.Enabled) { fxMesa->Stencil.Function = ctx->Stencil.Function[0] - GL_NEVER + GR_CMP_NEVER; - fxMesa->Stencil.RefValue = ctx->Stencil.Ref[0]; - fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask[0]; - fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask[0]; + fxMesa->Stencil.RefValue = ctx->Stencil.Ref[0] & 0xff; + fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask[0] & 0xff; + fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask[0] & 0xff; fxMesa->Stencil.FailFunc = convertGLStencilOp(ctx->Stencil.FailFunc[0]); fxMesa->Stencil.ZFailFunc = convertGLStencilOp(ctx->Stencil.ZFailFunc[0]); fxMesa->Stencil.ZPassFunc = convertGLStencilOp(ctx->Stencil.ZPassFunc[0]); diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 1daf49f151f..c8c6dc01933 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -233,7 +233,7 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all, if (mask & BUFFER_BIT_STENCIL) { if (vmesa->have_hw_stencil) { - if (ctx->Stencil.WriteMask[0] == 0xff) { + if ((ctx->Stencil.WriteMask[0] & 0xff) == 0xff) { flag |= VIA_DEPTH; clear_depth &= ~0xff; clear_depth |= (ctx->Stencil.Clear & 0xff); -- 2.30.2