summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-08 14:10:54 -0700
committerBrian <[email protected]>2007-02-08 14:10:54 -0700
commitfbf0f400b743686ccdf78b927fd5de477d764a9d (patch)
treec48b84b7740b650971cab807a22cce2f3cc31781
parent34af2b7194ad473c8ae20bcff933910f8386c3f0 (diff)
fix broken BRA for return stmts
-rw-r--r--src/mesa/shader/slang/slang_codegen.c6
-rw-r--r--src/mesa/shader/slang/slang_emit.c1
2 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 6671f31c478..f71bbead0a6 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -1407,7 +1407,7 @@ _slang_gen_while(slang_assemble_ctx * A, const slang_operation *oper)
prevLoop = A->CurLoop;
A->CurLoop = loop;
- cond = _slang_gen_operation(A, &oper->children[0]);
+ cond = new_cond(_slang_gen_operation(A, &oper->children[0]));
breakIf = new_break_if_false(A->CurLoop, cond);
body = _slang_gen_operation(A, &oper->children[1]);
loop->Children[0] = new_seq(breakIf, body);
@@ -1440,7 +1440,7 @@ _slang_gen_do(slang_assemble_ctx * A, const slang_operation *oper)
A->CurLoop = loop;
body = _slang_gen_operation(A, &oper->children[0]);
- cond = _slang_gen_operation(A, &oper->children[1]);
+ cond = new_cond(_slang_gen_operation(A, &oper->children[1]));
breakIf = new_break_if_false(A->CurLoop, cond);
loop->Children[0] = new_seq(body, breakIf);
@@ -1474,7 +1474,7 @@ _slang_gen_for(slang_assemble_ctx * A, const slang_operation *oper)
prevLoop = A->CurLoop;
A->CurLoop = loop;
- cond = _slang_gen_operation(A, &oper->children[1]);
+ cond = new_cond(_slang_gen_operation(A, &oper->children[1]));
breakIf = new_break_if_false(A->CurLoop, cond);
body = _slang_gen_operation(A, &oper->children[3]);
incr = _slang_gen_operation(A, &oper->children[2]);
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index d83880a26f2..e5727120267 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -487,6 +487,7 @@ new_instruction(struct gl_program *prog, gl_inst_opcode opcode)
prog->NumInstructions++;
_mesa_init_instructions(inst, 1);
inst->Opcode = opcode;
+ inst->BranchTarget = -1; /* invalid */
return inst;
}