i965: Remove bad constant buffer constant-reg-already-loaded optimization.
authorEric Anholt <eric@anholt.net>
Thu, 7 May 2009 04:44:13 +0000 (21:44 -0700)
committerRoland Scheidegger <sroland@vmware.com>
Sat, 4 Jul 2009 13:32:56 +0000 (15:32 +0200)
Thanks to branching, the state of c->current_const[i].index at the point
of emitting constant loads for this instruction may not match the actual
constant currently loaded in the reg at runtime.  Fixes a regression in my
GLSL program for idr's class since b58b3a786aa38dcc9d72144c2cc691151e46e3d5.

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

index 094c1af2fef4f89882ebeaea2c85335b14609c51..c06c820b4da601692b536e2d44ee20544af474e8 100644 (file)
@@ -294,23 +294,21 @@ static void fetch_constants(struct brw_wm_compile *c,
       if (src->File == PROGRAM_STATE_VAR ||
           src->File == PROGRAM_CONSTANT ||
           src->File == PROGRAM_UNIFORM) {
-         if (c->current_const[i].index != src->Index) {
-            c->current_const[i].index = src->Index;
+        c->current_const[i].index = src->Index;
 
 #if 0
-            printf("  fetch const[%d] for arg %d into reg %d\n",
-                   src->Index, i, c->current_const[i].reg.nr);
+        printf("  fetch const[%d] for arg %d into reg %d\n",
+               src->Index, i, c->current_const[i].reg.nr);
 #endif
 
-            /* need to fetch the constant now */
-            brw_dp_READ_4(p,
-                          c->current_const[i].reg,  /* writeback dest */
-                          1,                        /* msg_reg */
-                          src->RelAddr,             /* relative indexing? */
-                          16 * src->Index,          /* byte offset */
-                          SURF_INDEX_FRAG_CONST_BUFFER/* binding table index */
-                          );
-         }
+        /* need to fetch the constant now */
+        brw_dp_READ_4(p,
+                      c->current_const[i].reg,  /* writeback dest */
+                      1,                        /* msg_reg */
+                      src->RelAddr,             /* relative indexing? */
+                      16 * src->Index,          /* byte offset */
+                      SURF_INDEX_FRAG_CONST_BUFFER/* binding table index */
+                      );
       }
    }
 }