i965: Emit conditional code updates as required for GLSL VS if statements.
authorEric Anholt <eric@anholt.net>
Tue, 4 Aug 2009 21:13:27 +0000 (14:13 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 5 Aug 2009 01:06:34 +0000 (18:06 -0700)
Previously, we'd be branching based on whatever condition code happened to be
laying around.

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

index f0eb6eb2b6123b93dfc0f825c9140ed59c4561c8..bd584d2189edb76a61dbc6645f8f50fd0a9e06a5 100644 (file)
@@ -1558,6 +1558,19 @@ void brw_vs_emit(struct brw_vs_compile *c )
                                    "unknown");
       }
 
+      /* Set the predication update on the last instruction of the native
+       * instruction sequence.
+       *
+       * This would be problematic if it was set on a math instruction,
+       * but that shouldn't be the case with the current GLSL compiler.
+       */
+      if (inst->CondUpdate) {
+        struct brw_instruction *hw_insn = &p->store[p->nr_insn - 1];
+
+        assert(hw_insn->header.destreg__conditionalmod == 0);
+        hw_insn->header.destreg__conditionalmod = BRW_CONDITIONAL_NZ;
+      }
+
       if ((inst->DstReg.File == PROGRAM_OUTPUT)
           && (inst->DstReg.Index != VERT_RESULT_HPOS)
           && c->output_regs[inst->DstReg.Index].used_in_src) {