fix broken BRA for return stmts
authorBrian <brian@nostromo.localnet.net>
Thu, 8 Feb 2007 21:10:54 +0000 (14:10 -0700)
committerBrian <brian@nostromo.localnet.net>
Thu, 8 Feb 2007 21:10:54 +0000 (14:10 -0700)
src/mesa/shader/slang/slang_codegen.c
src/mesa/shader/slang/slang_emit.c

index 6671f31c4780a620101b8acde7ae9ab51071c913..f71bbead0a671dbcefdbbe5f694b736c487548fd 100644 (file)
@@ -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]);
index d83880a26f284c3084a2b49f7a489d4c2c616f59..e572712026716726643ceeb8cf53abc000302df5 100644 (file)
@@ -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;
 }