radeon/r200: fix color masking under dri2
authorDave Airlie <airlied@linux.ie>
Mon, 13 Jul 2009 13:41:32 +0000 (23:41 +1000)
committerDave Airlie <airlied@linux.ie>
Mon, 13 Jul 2009 15:23:24 +0000 (01:23 +1000)
Need to retrieve the bits from the rrb not from screen struct

src/mesa/drivers/dri/r200/r200_state.c
src/mesa/drivers/dri/radeon/radeon_state.c

index 4426f3c3ec71a50ab45946e59105239f48b928a4..c7c1a39316ac6be322d1f5f3184cb7c9aff8369f 100644 (file)
@@ -709,14 +709,20 @@ static void r200ColorMask( GLcontext *ctx,
                           GLboolean b, GLboolean a )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
-   GLuint mask = radeonPackColor( rmesa->radeon.radeonScreen->cpp,
-                               ctx->Color.ColorMask[RCOMP],
-                               ctx->Color.ColorMask[GCOMP],
-                               ctx->Color.ColorMask[BCOMP],
-                               ctx->Color.ColorMask[ACOMP] );
-
+   GLuint mask;
+   struct radeon_renderbuffer *rrb;
    GLuint flag = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] & ~R200_PLANE_MASK_ENABLE;
 
+   rrb = radeon_get_colorbuffer(&rmesa->radeon);
+   if (!rrb)
+     return;
+   mask = radeonPackColor( rrb->cpp,
+                          ctx->Color.ColorMask[RCOMP],
+                          ctx->Color.ColorMask[GCOMP],
+                          ctx->Color.ColorMask[BCOMP],
+                          ctx->Color.ColorMask[ACOMP] );
+
+
    if (!(r && g && b && a))
       flag |= R200_PLANE_MASK_ENABLE;
 
@@ -1720,11 +1726,16 @@ static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    GLubyte color[4];
+   struct radeon_renderbuffer *rrb;
+
+   rrb = radeon_get_colorbuffer(&rmesa->radeon);
+   if (!rrb)
+     return;
    CLAMPED_FLOAT_TO_UBYTE(color[0], c[0]);
    CLAMPED_FLOAT_TO_UBYTE(color[1], c[1]);
    CLAMPED_FLOAT_TO_UBYTE(color[2], c[2]);
    CLAMPED_FLOAT_TO_UBYTE(color[3], c[3]);
-   rmesa->radeon.state.color.clear = radeonPackColor( rmesa->radeon.radeonScreen->cpp,
+   rmesa->radeon.state.color.clear = radeonPackColor( rrb->cpp,
                                              color[0], color[1],
                                              color[2], color[3] );
 }
index 89d08f081838d890ac66ae1bb90931b8abfeb62b..78f7e9d633fa09d55b8cae5ef24b79e644d62cf4 100644 (file)
@@ -508,11 +508,18 @@ static void radeonColorMask( GLcontext *ctx,
                             GLboolean b, GLboolean a )
 {
    r100ContextPtr rmesa = R100_CONTEXT(ctx);
-   GLuint mask = radeonPackColor( rmesa->radeon.radeonScreen->cpp,
-                                 ctx->Color.ColorMask[RCOMP],
-                                 ctx->Color.ColorMask[GCOMP],
-                                 ctx->Color.ColorMask[BCOMP],
-                                 ctx->Color.ColorMask[ACOMP] );
+   struct radeon_renderbuffer *rrb;
+   GLuint mask;
+
+   rrb = radeon_get_colorbuffer(&rmesa->radeon);
+   if (!rrb)
+     return;
+
+   mask = radeonPackColor( rrb->cpp,
+                          ctx->Color.ColorMask[RCOMP],
+                          ctx->Color.ColorMask[GCOMP],
+                          ctx->Color.ColorMask[BCOMP],
+                          ctx->Color.ColorMask[ACOMP] );
 
    if ( rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] != mask ) {
       RADEON_STATECHANGE( rmesa, msk );
@@ -1500,11 +1507,17 @@ static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] )
 {
    r100ContextPtr rmesa = R100_CONTEXT(ctx);
    GLubyte c[4];
+   struct radeon_renderbuffer *rrb;
+
+   rrb = radeon_get_colorbuffer(&rmesa->radeon);
+   if (!rrb)
+     return;
+     
    CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
    CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
    CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
    CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-   rmesa->radeon.state.color.clear = radeonPackColor( rmesa->radeon.radeonScreen->cpp,
+   rmesa->radeon.state.color.clear = radeonPackColor( rrb->cpp,
                                               c[0], c[1], c[2], c[3] );
 }