i965: Fix fp-lit-src-equals-dst.
authorEric Anholt <eric@anholt.net>
Thu, 7 Jul 2011 23:41:20 +0000 (16:41 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 11 Jul 2011 15:58:37 +0000 (08:58 -0700)
We were stomping over the source for the body of the LIT instruction
when doing the MOV of 1.0 to the uninteresting channels.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_wm_fp.c

index 59dcda7b414b71d21fbab6652dde90f5e68b0860..87eabf1fba137fdb388edfd4e3155f9465fd13ab 100644 (file)
@@ -611,7 +611,17 @@ static void precalc_lit( struct brw_wm_compile *c,
 {
    struct prog_src_register src0 = inst->SrcReg[0];
    struct prog_dst_register dst = inst->DstReg;
-   
+
+   if (dst.WriteMask & WRITEMASK_YZ) {
+      emit_op(c,
+             OPCODE_LIT,
+             dst_mask(dst, WRITEMASK_YZ),
+             inst->SaturateMode,
+             src0,
+             src_undef(),
+             src_undef());
+   }
+
    if (dst.WriteMask & WRITEMASK_XW) {
       struct prog_instruction *swz;
 
@@ -627,16 +637,6 @@ static void precalc_lit( struct brw_wm_compile *c,
       /* Avoid letting the negation flag of src0 affect our 1 constant. */
       swz->SrcReg[0].Negate = NEGATE_NONE;
    }
-
-   if (dst.WriteMask & WRITEMASK_YZ) {
-      emit_op(c,
-             OPCODE_LIT,
-             dst_mask(dst, WRITEMASK_YZ),
-             inst->SaturateMode,
-             src0,
-             src_undef(),
-             src_undef());
-   }
 }