summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 40f4105a64..1b69277387 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 {