summaryrefslogtreecommitdiff
path: root/src/mesa/shader/prog_execute.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-12-22 14:21:07 -0700
committerBrian Paul <brianp@vmware.com>2009-12-22 14:26:06 -0700
commitddd9729bc37f4b1098ef940da6e723743db3ded8 (patch)
tree25f61b9e18db234ae38796105dec8ae44359e038 /src/mesa/shader/prog_execute.c
parentdb721151b76611b75bcedfc90221ef5f92e8edeb (diff)
mesa: adjust OPCODE_IF/ELSE BranchTarget fields to point to ELSE/ENDIF instr.
This is a little more logical. Suggested in bug report 25654.
Diffstat (limited to 'src/mesa/shader/prog_execute.c')
-rw-r--r--src/mesa/shader/prog_execute.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 56d174c6ce..7f034520cd 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -910,6 +910,10 @@ _mesa_execute_program(GLcontext * ctx,
case OPCODE_IF:
{
GLboolean cond;
+ ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ == OPCODE_ELSE ||
+ program->Instructions[inst->BranchTarget].Opcode
+ == OPCODE_ENDIF);
/* eval condition */
if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) {
GLfloat a[4];
@@ -929,14 +933,16 @@ _mesa_execute_program(GLcontext * ctx,
else {
/* go to the instruction after ELSE or ENDIF */
assert(inst->BranchTarget >= 0);
- pc = inst->BranchTarget - 1;
+ pc = inst->BranchTarget;
}
}
break;
case OPCODE_ELSE:
/* goto ENDIF */
+ ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ == OPCODE_ENDIF);
assert(inst->BranchTarget >= 0);
- pc = inst->BranchTarget - 1;
+ pc = inst->BranchTarget;
break;
case OPCODE_ENDIF:
/* nothing */