summaryrefslogtreecommitdiff
path: root/src/mesa/shader/prog_execute.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-12-22 14:15:30 -0700
committerBrian Paul <brianp@vmware.com>2009-12-22 14:26:06 -0700
commitdb721151b76611b75bcedfc90221ef5f92e8edeb (patch)
treef7b8f781859d436ac23eef8e5e672b3345e9ef0f /src/mesa/shader/prog_execute.c
parente8ea2d26cd9e90d45cdfb94c3a6b06e27d6c0083 (diff)
mesa: adjust BRK/CONT BranchTarget to always point to ENDLOOP instruction
To be more consistant.
Diffstat (limited to 'src/mesa/shader/prog_execute.c')
-rw-r--r--src/mesa/shader/prog_execute.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 025665a06e..56d174c6ce 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -698,12 +698,26 @@ _mesa_execute_program(GLcontext * ctx,
case OPCODE_ENDSUB: /* end subroutine */
break;
case OPCODE_BRA: /* branch (conditional) */
- /* fall-through */
+ if (eval_condition(machine, inst)) {
+ /* take branch */
+ /* Subtract 1 here since we'll do pc++ below */
+ pc = inst->BranchTarget - 1;
+ }
+ break;
case OPCODE_BRK: /* break out of loop (conditional) */
- /* fall-through */
+ ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ == OPCODE_ENDLOOP);
+ if (eval_condition(machine, inst)) {
+ /* break out of loop */
+ /* pc++ at end of for-loop will put us after the ENDLOOP inst */
+ pc = inst->BranchTarget;
+ }
+ break;
case OPCODE_CONT: /* continue loop (conditional) */
+ ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ == OPCODE_ENDLOOP);
if (eval_condition(machine, inst)) {
- /* take branch */
+ /* continue at ENDLOOP */
/* Subtract 1 here since we'll do pc++ at end of for-loop */
pc = inst->BranchTarget - 1;
}