r300/compiler: r500-fs: Properly set HW register swizzles.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Wed, 10 Feb 2010 20:31:18 +0000 (12:31 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Wed, 10 Feb 2010 20:35:30 +0000 (12:35 -0800)
Fixes fallout from 9a1bf52c.

src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c

index d87acecdabed5cb9fda00cdb034272cd25859175..b0fb8e970b79cb4bd6a4014e52eac69b7758c473 100644 (file)
@@ -295,7 +295,7 @@ static char *toswiz(int swiz_val) {
   case 2: return "B";
   case 3: return "A";
   case 4: return "0";
-  case 5: return "1/2";
+  case 5: return "H";
   case 6: return "1";
   case 7: return "U";
   }
index c2eb613b23f26c92d86affa3dd0ab6875221a046..829f028950c99b191d4a46156004d6e2e49b9c84 100644 (file)
@@ -121,8 +121,19 @@ static unsigned int translate_alpha_op(struct r300_fragment_program_compiler *c,
 
 static unsigned int fix_hw_swizzle(unsigned int swz)
 {
-       if (swz == 5) swz = 6;
-       if (swz == RC_SWIZZLE_UNUSED) swz = 4;
+    switch (swz) {
+        case RC_SWIZZLE_ZERO:
+        case RC_SWIZZLE_UNUSED:
+            swz = 4;
+            break;
+        case RC_SWIZZLE_HALF:
+            swz = 5;
+            break;
+        case RC_SWIZZLE_ONE:
+            swz = 6;
+            break;
+    }
+
        return swz;
 }