summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-07-24 15:49:09 -0600
committerBrian Paul <[email protected]>2008-07-24 15:49:09 -0600
commit7b2ef2b8849bbf400eeed9642c26c140cc7d6beb (patch)
tree88dc1298d62429871fe0f66cea6b5ffca66b1224 /src/mesa/shader/slang
parent643228c506bde965c890f3d0604c273fc729bee7 (diff)
mesa: gls: fix broken else clause of conditional break/continue
In the following case: for () { if (cond) break; // or continue; else something; } The "something" block didn't get emitted.
Diffstat (limited to 'src/mesa/shader/slang')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c14
-rw-r--r--src/mesa/shader/slang/slang_emit.c4
2 files changed, 5 insertions, 13 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 40f4105a64d..1b69277387e 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2194,22 +2194,16 @@ _slang_gen_if(slang_assemble_ctx * A, const slang_operation *oper)
cond = _slang_gen_operation(A, &oper->children[0]);
cond = new_cond(cond);
- if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK)) {
+ if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK)
+ && !haveElseClause) {
/* Special case: generate a conditional break */
ifBody = new_break_if_true(A->CurLoop, cond);
- if (haveElseClause) {
- elseBody = _slang_gen_operation(A, &oper->children[2]);
- return new_seq(ifBody, elseBody);
- }
return ifBody;
}
- else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE)) {
+ else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE)
+ && !haveElseClause) {
/* Special case: generate a conditional break */
ifBody = new_cont_if_true(A->CurLoop, cond);
- if (haveElseClause) {
- elseBody = _slang_gen_operation(A, &oper->children[2]);
- return new_seq(ifBody, elseBody);
- }
return ifBody;
}
else {
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index c28894630ce..1f4d962bdf6 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -161,9 +161,7 @@ free_temp_storage(slang_var_table *vt, slang_ir_node *n)
if (_slang_is_temp(vt, n->Store)) {
_slang_free_temp(vt, n->Store);
n->Store->Index = -1;
- n->Store->Size = -1;
- /*_mesa_free(n->Store);*/ /* XXX leak */
- n->Store = NULL;
+ n->Store = NULL; /* XXX this may not be needed */
}
}
}