Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl_codegen.c:
} + else if (instr->type == HLSL_IR_SWITCH) + { + struct hlsl_ir_switch *s = hlsl_ir_switch(instr); + struct hlsl_ir_switch_case *c; + + LIST_FOR_EACH_ENTRY(c, &s->cases, struct hlsl_ir_switch_case, entry) + { + has_early_return |= lower_return(ctx, func, &c->body, true); + } + + if (has_early_return) + { + /* If we're in a loop, we don't need to do anything here. We + * turned the return into a break, and that will already skip + * anything that comes after this "if" block. */
This isn't true, though, because "break" only breaks out of the switch. We'll need to handle these like loops. We don't have any tests for this case, either. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/361#note_49497