1half4 main(float2 coords) { 2 half4 result = half4(0); 3 4 // Two variables, both used 5 for (half a = 0, b = 0; a < 10 && b < 10; ++a, ++b) { 6 result.r += a; 7 result.g += b; 8 } 9 10 // Two variables, one dead 11 for (int c = 0, d = 0; c < 10; ++c) { 12 result.b += 1; 13 } 14 15 // Three variables, all used, some array-typed 16 for (float d[2] = float[2](0, 10), e[4] = float[4](1,2,3,4), f = 9; d[0] < d[1]; ++d[0]) { 17 result.a = half(e[0] * f); 18 } 19 20 // Four variables, all dead 21 for (half4 x, y, z, w;; ) break; 22 23 // Just referencing a variable instead of declaring it--legal, if not meaningful. 24 for (result;; ) break; 25 26 return result; 27} 28