Mesa (7.11): prog_optimize: Set unused regs to PROGRAM_UNDEFINED after CMP- >MOV conversion

Ian Romanick idr at kemper.freedesktop.org
Thu Jul 28 18:48:47 UTC 2011


Module: Mesa
Branch: 7.11
Commit: a2b8802ed587ae8247f4031b8e29e1dee8b2b713
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2b8802ed587ae8247f4031b8e29e1dee8b2b713

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Jul 20 18:02:17 2011 -0700

prog_optimize: Set unused regs to PROGRAM_UNDEFINED after CMP->MOV conversion

Leaving the unused registers with other values caused assertion
failures and other problems in places that blindly iterate over all
sources.

brw_vs_emit.c:1381: get_src_reg: Assertion `c->regs[file][index].nr !=
0' failed.

Fixes i965 piglit:

    vs-uniform-array-mat[234]-col-row-rd
    vs-uniform-array-mat[234]-index-col-row-rd
    vs-uniform-array-mat[234]-index-row-rd
    vs-uniform-mat[234]-col-row-rd

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>
(cherry picked from commit fbeb68e880318808f90c779cd3f8b8c4160eecf8)

---

 src/mesa/program/prog_optimize.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c
index 8a40fa6..f4a7a63 100644
--- a/src/mesa/program/prog_optimize.c
+++ b/src/mesa/program/prog_optimize.c
@@ -1319,6 +1319,15 @@ _mesa_simplify_cmp(struct gl_program * program)
 
          inst->Opcode = OPCODE_MOV;
          inst->SrcReg[0] = inst->SrcReg[1];
+
+	 /* Unused operands are expected to have the file set to
+	  * PROGRAM_UNDEFINED.  This is how _mesa_init_instructions initializes
+	  * all of the sources.
+	  */
+	 inst->SrcReg[1].File = PROGRAM_UNDEFINED;
+	 inst->SrcReg[1].Swizzle = SWIZZLE_NOOP;
+	 inst->SrcReg[2].File = PROGRAM_UNDEFINED;
+	 inst->SrcReg[2].Swizzle = SWIZZLE_NOOP;
       }
    }
    if (dbg) {




More information about the mesa-commit mailing list