Giovanni Mascellani (@giomasce) commented about tests/hlsl/switch.shader_test:
+[pixel shader] +uint4 v;
+float4 main() : sv_target +{
- switch (v.x)
- {
- case 0:
return 3.0;
- case 1:
return 4.0;
- default:
return 5.0;
- }
+}
There are probably a few other things we'd like to test: * falling through, together with its correct side effects; * `break` working properly; * `break` and `continue` doing the right thing for a `switch` inside a `for`; * check that non-constant cases are rejected; * check that cases which require constant folding work properly (i.e., `case 1+1:`); * check that duplicate cases are rejected; * maybe even checking a `switch` without a `default`.
On top of that, it would be nice to have the tests introduced at the beginning as `todo` and then solved as needed.