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:
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 */