Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl_codegen.c:
if (node->type == HLSL_IR_JUMP)
{
jump = hlsl_ir_jump(node);
terminal_break = jump->type == HLSL_IR_JUMP_BREAK;
}
if (!terminal_break)
break;
- }
- if (!terminal_break)
- {
hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX,
"Switch cases blocks must be terminated with 'break' or 'return'.");
return true;
- }
Why is this error not per-case? I guess you're trying to report it only once for the whole switch, but why?
I also notice we don't have tests for ending a case with 'discard' instead of return. That's indeed forbidden but we should explicitly test it.