fix off by one error in OPCODE_RET
authorBrian <brian@yutani.localnet.net>
Tue, 27 Mar 2007 17:02:20 +0000 (11:02 -0600)
committerBrian <brian@yutani.localnet.net>
Tue, 27 Mar 2007 22:06:47 +0000 (16:06 -0600)
src/mesa/shader/prog_execute.c

index f881d477caa58e08e554cfb4c5a4540d98abbe14..37240820e79790d65aea63c6583c80a0f2f4779e 100644 (file)
@@ -752,8 +752,8 @@ _mesa_execute_program(GLcontext * ctx,
             if (machine->StackDepth >= MAX_PROGRAM_CALL_DEPTH) {
                return GL_TRUE;  /* Per GL_NV_vertex_program2 spec */
             }
-            machine->CallStack[machine->StackDepth++] = pc + 1;
-            pc = inst->BranchTarget;    /* XXX - 1 ??? */
+            machine->CallStack[machine->StackDepth++] = pc + 1; /* next inst */
+            pc = inst->BranchTarget;
          }
          break;
       case OPCODE_CMP:
@@ -1305,7 +1305,8 @@ _mesa_execute_program(GLcontext * ctx,
             if (machine->StackDepth == 0) {
                return GL_TRUE;  /* Per GL_NV_vertex_program2 spec */
             }
-            pc = machine->CallStack[--machine->StackDepth];
+            /* subtract one because of pc++ in the for loop */
+            pc = machine->CallStack[--machine->StackDepth] - 1;
          }
          break;
       case OPCODE_RFL:         /* reflection vector */