updates to dri drivers for recent stencil changes
authorKeith Whitwell <keith@tungstengraphics.com>
Mon, 8 May 2006 09:03:35 +0000 (09:03 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Mon, 8 May 2006 09:03:35 +0000 (09:03 +0000)
12 files changed:
src/mesa/drivers/dri/i915/intel_ioctl.c
src/mesa/drivers/dri/r128/r128_state.c
src/mesa/drivers/dri/r200/r200_state.c
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/radeon/radeon_state.c
src/mesa/drivers/dri/savage/savagestate.c
src/mesa/drivers/dri/sis/sis_clear.c
src/mesa/drivers/dri/sis/sis_state.c
src/mesa/drivers/dri/sis/sis_stencil.c
src/mesa/drivers/dri/tdfx/tdfx_render.c
src/mesa/drivers/dri/tdfx/tdfx_state.c
src/mesa/drivers/dri/unichrome/via_ioctl.c

index 4f570c0e0fa9a76fd0829cc862ae6be2db7b51b5..d8530367664ebb02e7c2b87493b771327d171305 100644 (file)
@@ -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 {
index e9149306d87f2c6280675b28ae0d1eab0732d170..1b2c2a5284ee45eef42514241d0a77fb038c6754 100644 (file)
@@ -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;
index 43ae7b6678074105ae4fe41aab2210735c90d465..6ffb48c1505b9f28741ce305aab5298761f5e41d 100644 (file)
@@ -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));
 }
 
 
index ae0d271521025fd32868037b8769a9d9308cd007..70d42c2ea3be54d2fd1de2cca72c408841e7245b 100644 (file)
@@ -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));
 }
 
 /* =============================================================
index 447619b56d06a06ce301af83e3fa21ac1663ee6f..307c1f341b42b1c4b97712d32e7cdce3e8d3402a 100644 (file)
@@ -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));
 }
 
 
index 44cf2f20d37dc900955fdaca71dadce8720bd454..3a267e025c931a9b37a1abab5eb4cfa57b22e87b 100644 (file)
@@ -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;
     }
 }
index d7807b157e9fcd923bffb949267d274267ff3de6..637d502381e82c17b3114981fdfead24eeb11bcf 100644 (file)
@@ -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;
index 1a4c32411533df47f2254a80c6f17cfd86250b1f..a30001c7462e1a1657cb8ce3269a04d68b84dc04 100644 (file)
@@ -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;
index 1febe86b94c60bde86b84e730a4f374096556639..a1ce2966e891a2ef00857d87fb4397a0c91f7e1f 100644 (file)
@@ -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)
     {
index 56f5f147eeb5274cf57ca8b2ef32bdf73d8135f9..a30ec78a5581df87f05042d12eb53758f37663ff 100644 (file)
@@ -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);
             }
index 1869de4737460e4fae08fe5968104e0184a130f4..a389273b2f0783800599a1903ba3ba5d186410cf 100644 (file)
@@ -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]);
index 1daf49f151fb42b10983dfc83e6e4dc3cfa4e958..c8c6dc0193318c18ab5d7dd97acc97344132d160 100644 (file)
@@ -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);