Mesa (master): i965: Remove bad constant buffer constant-reg-already-loaded optimization.

Eric Anholt anholt at kemper.freedesktop.org
Wed May 6 21:49:04 PDT 2009


Module: Mesa
Branch: master
Commit: 3d048e57504c63999aeaaf5a65e8e493e6a67ff7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d048e57504c63999aeaaf5a65e8e493e6a67ff7

Author: Eric Anholt <eric at anholt.net>
Date:   Wed May  6 21:44:13 2009 -0700

i965: Remove bad constant buffer constant-reg-already-loaded optimization.

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 |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 39ea95f..cc2c6ab 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -407,23 +407,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 */
+		       );
       }
    }
 }



More information about the mesa-commit mailing list