1uniform half4 testInputs, colorGreen, colorRed; 2 3half4 constant_swizzle() { 4 half4 v = testInputs; 5 half x = v[0]; 6 half y = v[1]; 7 half z = v[2]; 8 half w = v[3]; 9 return half4(x, y, z, w); // -1.25, 0, 0.75, 2.25 10} 11 12half4 foldable_index() { 13 const int ZERO = 0, ONE = 1, TWO = 2, THREE = 3; 14 half x = testInputs[ZERO]; 15 half y = testInputs[ONE]; 16 half z = testInputs[TWO]; 17 half w = testInputs[THREE]; 18 return half4(x, y, z, w); // -1.25, 0, 0.75, 2.25 19} 20 21half4 foldable() { 22 half4 v = half4(0, 1, 2, 3); 23 half x = v[0]; 24 half y = v[1]; 25 half z = v[2]; 26 half w = v[3]; 27 return half4(x, y, z, w); // 0, 1, 2, 3 28} 29 30half4 main(float2 coords) { 31 half4 a = constant_swizzle(); 32 half4 b = foldable_index(); 33 half4 c = foldable(); 34 35 return a == half4(-1.25, 0, 0.75, 2.25) && 36 b == half4(-1.25, 0, 0.75, 2.25) && 37 c == half4(0, 1, 2, 3) ? colorGreen : colorRed; 38} 39