1uniform half4 colorRed, colorGreen; 2 3bool test() { 4 const float floatOne = 1; 5 const int intOne = 1; 6 const half4 half4One = half4(1); 7 const int4 int4One = int4(1); 8 9 bool ok = true; 10 11 // Typecasting a constant scalar variable should fold away. 12 ok = ok && (int(floatOne) == intOne); 13 ok = ok && (float(intOne) == floatOne); 14 15 // Typecasting a constant vector variable should fold away. 16 ok = ok && (int4(half4One) == int4One); 17 ok = ok && (half4(int4One) == half4One); 18 19 // More complex cases should also fold. 20 ok = ok && (int4(half4One) == int4(intOne)); // cast(vector) == splat(scalar) 21 ok = ok && (half4(int4One) == half4(half(floatOne))); // cast(vector) == splat(cast(scalar)) 22 ok = ok && (half4(intOne) == half4(float4(floatOne))); // splatcast(sclr) == cast(splat(sclr)) 23 24 return ok; 25} 26 27half4 main(float2 coords) { 28 return test() ? colorGreen : colorRed; 29} 30