st/mesa: fix incorrect loop over instruction src regs
authorBrian Paul <brianp@vmware.com>
Tue, 16 Aug 2011 22:30:52 +0000 (16:30 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 17 Aug 2011 14:12:54 +0000 (08:12 -0600)
The array of src regs is of size 3, not 4.

src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index aef23e7..7b90c81 100644 (file)
@@ -3443,7 +3443,7 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void)
          /* Continuing the block, clear any channels from the write array that
           * are read by this instruction.
           */
-         for (int i = 0; i < 4; i++) {
+         for (unsigned i = 0; i < Elements(inst->src); i++) {
             if (inst->src[i].file == PROGRAM_TEMPORARY && inst->src[i].reladdr){
                /* Any temporary might be read, so no dead code elimination 
                 * across this instruction.