i965: Handle the negate and abs swizzles on brw_wm_glsl.c immediate args.
authorEric Anholt <eric@anholt.net>
Wed, 24 Mar 2010 17:26:05 +0000 (10:26 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 24 Mar 2010 17:27:30 +0000 (10:27 -0700)
Fixes piglit glsl-orangebook-ch06-bump, regressed with
4fc57322258a750c0a9cabc77372b5ccde1fa877

src/mesa/drivers/dri/i965/brw_wm_glsl.c

index d78fb4ed09f8af486102b7f993ff0302e009764c..3b7e421b16ad7a5fedbee389d3076ce6936b1eb7 100644 (file)
@@ -583,11 +583,21 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c,
        if (component == SWIZZLE_ZERO) {
          return brw_imm_f(0.0F);
        } else if (component == SWIZZLE_ONE) {
-         return brw_imm_f(1.0F);
+         if (src->Negate)
+            return brw_imm_f(-1.0F);
+         else
+            return brw_imm_f(1.0F);
        }
 
        if (src->File == PROGRAM_CONSTANT) {
-         return brw_imm_f(params->ParameterValues[src->Index][component]);
+         float f = params->ParameterValues[src->Index][component];
+
+         if (src->Abs)
+            f = fabs(f);
+         if (src->Negate)
+            f = -f;
+
+         return brw_imm_f(f);
        }
     }