r300/compiler: shorten RC_*SWIZZLE* expressions
authorMarek Olšák <maraeo@gmail.com>
Fri, 7 May 2010 23:34:38 +0000 (01:34 +0200)
committerMarek Olšák <maraeo@gmail.com>
Sat, 8 May 2010 21:03:44 +0000 (23:03 +0200)
src/mesa/drivers/dri/r300/compiler/radeon_code.c
src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h
src/mesa/drivers/dri/r300/r300_fragprog_common.c

index 853b2becd1b6b63d070e109e21b4423fdb3f1592..0eab18c344da79271959f475262c48e114175ee3 100644 (file)
@@ -146,7 +146,7 @@ unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float da
                        unsigned comp;
                        for(comp = 0; comp < c->Constants[index].Size; ++comp) {
                                if (c->Constants[index].u.Immediate[comp] == data) {
-                                       *swizzle = RC_MAKE_SWIZZLE(comp, comp, comp, comp);
+                                       *swizzle = RC_MAKE_SWIZZLE_SMEAR(comp);
                                        return index;
                                }
                        }
@@ -159,7 +159,7 @@ unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float da
        if (free_index >= 0) {
                unsigned comp = c->Constants[free_index].Size++;
                c->Constants[free_index].u.Immediate[comp] = data;
-               *swizzle = RC_MAKE_SWIZZLE(comp, comp, comp, comp);
+               *swizzle = RC_MAKE_SWIZZLE_SMEAR(comp);
                return free_index;
        }
 
index d806309552e5a83e616cb5bfef8bf422945dc4c7..5ba2c29408cff013bc554c6f5218de5df0e734cc 100644 (file)
@@ -813,7 +813,7 @@ int radeonTransformDeriv(struct radeon_compiler* c,
        if (inst->U.I.Opcode != RC_OPCODE_DDX && inst->U.I.Opcode != RC_OPCODE_DDY)
                return 0;
 
-       inst->U.I.SrcReg[1].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_ONE, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE);
+       inst->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_1111;
        inst->U.I.SrcReg[1].Negate = RC_MASK_XYZW;
 
        return 1;
index 842012def02d9e998528f24e6afe58bc0b68a0d9..2ddf60b6774e53cb2629fe28515eeed49d7167f3 100644 (file)
@@ -115,6 +115,7 @@ typedef enum {
 
 #define RC_SWIZZLE_XYZW RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W)
 #define RC_SWIZZLE_XYZ0 RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO)
+#define RC_SWIZZLE_XYZZ RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z)
 #define RC_SWIZZLE_XXXX RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_X)
 #define RC_SWIZZLE_YYYY RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Y)
 #define RC_SWIZZLE_ZZZZ RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Z)
index 6b1457c1e151562c1af6b7e52a3e186ecc5e2cbb..e678a42ca26d5d12a518a4072aebfdb3bf897f8f 100644 (file)
@@ -50,7 +50,7 @@ static GLuint build_dts(GLuint depthmode)
 {
        switch(depthmode) {
        default:
-       case GL_LUMINANCE: return RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z);
+       case GL_LUMINANCE: return RC_SWIZZLE_XYZZ;
        case GL_INTENSITY: return RC_SWIZZLE_XYZW;
        case GL_ALPHA: return RC_SWIZZLE_WWWW;
        }