[r300] Document R300_RB3D_COLORMASK properly and rename it to RB3D_COLOR_CHANNEL_MASK
authorChristoph Brill <egore911@egore911.de>
Mon, 25 Feb 2008 20:04:23 +0000 (21:04 +0100)
committerChristoph Brill <egore911@egore911.de>
Mon, 25 Feb 2008 20:04:23 +0000 (21:04 +0100)
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_ioctl.c
src/mesa/drivers/dri/r300/r300_reg.h
src/mesa/drivers/dri/r300/r300_state.c

index 399799e..951af7f 100644 (file)
@@ -412,7 +412,7 @@ void r300InitCmdBuf(r300ContextPtr r300)
        ALLOC_STATE(bld, always, R300_BLD_CMDSIZE, 0);
        r300->hw.bld.cmd[R300_BLD_CMD_0] = cmdpacket0(R300_RB3D_CBLEND, 2);
        ALLOC_STATE(cmk, always, R300_CMK_CMDSIZE, 0);
-       r300->hw.cmk.cmd[R300_CMK_CMD_0] = cmdpacket0(R300_RB3D_COLORMASK, 1);
+       r300->hw.cmk.cmd[R300_CMK_CMD_0] = cmdpacket0(RB3D_COLOR_CHANNEL_MASK, 1);
        ALLOC_STATE(blend_color, always, 4, 0);
        r300->hw.blend_color.cmd[0] = cmdpacket0(R300_RB3D_BLEND_COLOR, 3);
        ALLOC_STATE(cb, always, R300_CB_CMDSIZE, 0);
index 85952cb..1cd74e3 100644 (file)
@@ -106,13 +106,13 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
        e32(cbpitch);
 
        R300_STATECHANGE(r300, cmk);
-       reg_start(R300_RB3D_COLORMASK, 0);
+       reg_start(RB3D_COLOR_CHANNEL_MASK, 0);
 
        if (flags & CLEARBUFFER_COLOR) {
-               e32((ctx->Color.ColorMask[BCOMP] ? R300_COLORMASK0_B : 0) |
-                   (ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) |
-                   (ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) |
-                   (ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0));
+               e32((ctx->Color.ColorMask[BCOMP] ? RB3D_COLOR_CHANNEL_MASK_BLUE_MASK0 : 0) |
+                   (ctx->Color.ColorMask[GCOMP] ? RB3D_COLOR_CHANNEL_MASK_GREEN_MASK0 : 0) |
+                   (ctx->Color.ColorMask[RCOMP] ? RB3D_COLOR_CHANNEL_MASK_RED_MASK0 : 0) |
+                   (ctx->Color.ColorMask[ACOMP] ? RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK0 : 0));
        } else {
                e32(0x0);
        }
index 6296f00..0e06886 100644 (file)
@@ -1573,11 +1573,27 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_SRC_BLEND_SHIFT                  (16)
 #       define R300_DST_BLEND_SHIFT                  (24)
 #define R300_RB3D_BLEND_COLOR               0x4E10
-#define R300_RB3D_COLORMASK                 0x4E0C
-#       define R300_COLORMASK0_B                 (1<<0)
-#       define R300_COLORMASK0_G                 (1<<1)
-#       define R300_COLORMASK0_R                 (1<<2)
-#       define R300_COLORMASK0_A                 (1<<3)
+/* 3D Color Channel Mask. If all the channels used in the current color format
+ * are disabled, then the cb will discard all the incoming quads. Pipelined
+ * through the blender.
+ */
+#define RB3D_COLOR_CHANNEL_MASK                  0x4E0C
+#      define RB3D_COLOR_CHANNEL_MASK_BLUE_MASK0  (1 << 0)
+#      define RB3D_COLOR_CHANNEL_MASK_GREEN_MASK0 (1 << 1)
+#      define RB3D_COLOR_CHANNEL_MASK_RED_MASK0   (1 << 2)
+#      define RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK0 (1 << 3)
+#      define RB3D_COLOR_CHANNEL_MASK_BLUE_MASK1  (1 << 4)
+#      define RB3D_COLOR_CHANNEL_MASK_GREEN_MASK1 (1 << 5)
+#      define RB3D_COLOR_CHANNEL_MASK_RED_MASK1   (1 << 6)
+#      define RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK1 (1 << 7)
+#      define RB3D_COLOR_CHANNEL_MASK_BLUE_MASK2  (1 << 8)
+#      define RB3D_COLOR_CHANNEL_MASK_GREEN_MASK2 (1 << 9)
+#      define RB3D_COLOR_CHANNEL_MASK_RED_MASK2   (1 << 10)
+#      define RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK2 (1 << 11)
+#      define RB3D_COLOR_CHANNEL_MASK_BLUE_MASK3  (1 << 12)
+#      define RB3D_COLOR_CHANNEL_MASK_GREEN_MASK3 (1 << 13)
+#      define RB3D_COLOR_CHANNEL_MASK_RED_MASK3   (1 << 14)
+#      define RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK3 (1 << 15)
 
 /* gap */
 
@@ -1606,7 +1622,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
  * Bit 18: Extremely weird tile like, but some pixels duplicated?
  */
 #define R300_RB3D_COLORPITCH0               0x4E38
-#       define R300_COLORPITCH_MASK              0x00001FF8 /* GUESS */
+#       define R300_COLORPITCH_MASK              0x00001FF8 /* GUESS, should be 13:1 */
 #       define R300_COLOR_TILE_DISABLE            (0 << 16)
 #       define R300_COLOR_TILE_ENABLE             (1 << 16)
 #       define R300_COLOR_MICROTILE_DISABLE       (0 << 17)
index cc41797..bdb8106 100644 (file)
@@ -605,9 +605,10 @@ static void r300ColorMask(GLcontext * ctx,
                          GLboolean r, GLboolean g, GLboolean b, GLboolean a)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
-       int mask = (r ? R300_COLORMASK0_R : 0) |
-           (g ? R300_COLORMASK0_G : 0) |
-           (b ? R300_COLORMASK0_B : 0) | (a ? R300_COLORMASK0_A : 0);
+       int mask = (r ? RB3D_COLOR_CHANNEL_MASK_RED_MASK0 : 0) |
+           (g ? RB3D_COLOR_CHANNEL_MASK_GREEN_MASK0 : 0) |
+           (b ? RB3D_COLOR_CHANNEL_MASK_BLUE_MASK0 : 0) |
+           (a ? RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK0 : 0);
 
        if (mask != r300->hw.cmk.cmd[R300_CMK_COLORMASK]) {
                R300_STATECHANGE(r300, cmk);