From: Brian Date: Tue, 27 Mar 2007 17:02:20 +0000 (-0600) Subject: fix off by one error in OPCODE_RET X-Git-Tag: 062012170305~19703 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0275b0d2c071ed8254c2af3a0c53eec9d3561a6;p=profile%2Fivi%2Fmesa.git fix off by one error in OPCODE_RET --- diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index f881d47..3724082 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -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 */