| uniform half4 colorGreen, colorRed; |
| uniform float2x2 testMatrix2x2; |
| |
| half4 main(float2) { |
| bool ok = true; |
| |
| // Prefix ++ and -- (scalar int). |
| int i = 5; |
| ++i; |
| ok = ok && (i == 6); |
| ok = ok && (++i == 7); |
| ok = ok && (--i == 6); |
| --i; |
| ok = ok && (i == 5); |
| |
| // Prefix ++ and -- (scalar float). |
| float f = 0.5; |
| ++f; |
| ok = ok && (f == 1.5); |
| ok = ok && (++f == 2.5); |
| ok = ok && (--f == 1.5); |
| --f; |
| ok = ok && (f == 0.5); |
| |
| // Prefix ++ and -- (vector-component float). |
| float2 f2 = float2(0.5); |
| ++f2.x; |
| ok = ok && (f2.x == 1.5); |
| ok = ok && (++f2.x == 2.5); |
| ok = ok && (--f2.x == 1.5); |
| --f2.x; |
| ok = ok && (f2.x == 0.5); |
| |
| // Prefix '!' |
| ok = ok && !(colorGreen.r == 1.0); |
| |
| // Prefix '-' (scalar, vector, matrix float) |
| ok = ok && (-1 == -colorGreen.g); |
| ok = ok && (half4(0, -1, 0, -1) == -colorGreen); |
| ok = ok && (float2x2(-1, -2, -3, -4) == -testMatrix2x2); |
| |
| // Prefix '-' (scalar, vector int) |
| int2 iv = int2(i, -i); // (5, -5) |
| ok = ok && (-i == -5); |
| ok = ok && (-iv == int2(-5, 5)); |
| |
| return ok ? colorGreen : colorRed; |
| } |