% Unrolling edge cases. [pixel shader todo(sm<4)] float a : register(c0); float4 main() : sv_target { int i; if (a > 0) { [unroll] for (i = 0; i < 10; ++i); return float4(i, a, 2.0, 3.0); } return float4(0.0, a, 3.0, 4.0); } [test] uniform 0 float 1 todo(sm<4 | msl) draw quad probe (0,0) rgba(10.0, 1.0, 2.0, 3.0) [pixel shader] float4 main() : sv_target { int i; [unroll(4)] for (i = 0; i < 8; ++i); return float4(i, 0, 0, 0); } [test] todo(msl) draw quad probe (0,0) rgba(4.0, 0.0, 0.0, 0.0) [pixel shader fail(sm<6)] float4 main() : sv_target { int i; [unroll] for (i = 0; i < 1024; ++i); return float4(i, 0, 0, 0); } [test] todo(glsl) draw quad probe (0,0) rgba(1024.0, 0, 0, 0) [pixel shader] float4 main() : sv_target { int i; [unroll(1337)] for (i = 0; i < 1337; ++i); return float4(i, 0, 0, 0); } [test] todo(msl) draw quad probe (0,0) rgba(1337.0, 0, 0, 0)