Mesa (master): glsl: Fix handling of OPCODE_PRINT for no registers case.

Vinson Lee vlee at kemper.freedesktop.org
Sun Apr 18 07:22:58 UTC 2010


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

Author: Vinson Lee <vlee at vmware.com>
Date:   Sun Apr 18 00:11:49 2010 -0700

glsl: Fix handling of OPCODE_PRINT for no registers case.

A register file value is unsigned so could never be -1. A
value of 0 also aliased to PROGRAM_TEMPORARY.

If an OPCODE_PRINT has no registers to print, set the register
file value to PROGRAM_UNDEFINED and check for that value when
executing this instruction.

---

 src/mesa/shader/nvvertparse.c  |    2 +-
 src/mesa/shader/prog_execute.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c
index 631b315..7332fc4 100644
--- a/src/mesa/shader/nvvertparse.c
+++ b/src/mesa/shader/nvvertparse.c
@@ -1096,7 +1096,7 @@ Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction *
       }
    }
    else {
-      srcReg->File = 0;
+      srcReg->File = PROGRAM_UNDEFINED;
    }
 
    /* semicolon */
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 37750cc..0067512 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -1767,7 +1767,7 @@ _mesa_execute_program(GLcontext * ctx,
          break;
       case OPCODE_PRINT:
          {
-            if (inst->SrcReg[0].File != -1) {
+            if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
                GLfloat a[4];
                fetch_vector4(&inst->SrcReg[0], machine, a);
                printf("%s%g, %g, %g, %g\n", (const char *) inst->Data,




More information about the mesa-commit mailing list