| uniform half4 colorGreen, colorRed; |
| |
| half4 main(float2 c) { |
| bool ok = true; |
| |
| // Postfix ++ and -- (scalar int). |
| int i = 5; |
| i++; |
| ok = ok && (i++ == 6); |
| ok = ok && (i == 7); |
| ok = ok && (i-- == 7); |
| ok = ok && (i == 6); |
| i--; |
| ok = ok && (i == 5); |
| |
| // Postfix ++ and -- (scalar float). |
| float f = 0.5; |
| f++; |
| ok = ok && (f++ == 1.5); |
| ok = ok && (f == 2.5); |
| ok = ok && (f-- == 2.5); |
| ok = ok && (f == 1.5); |
| f--; |
| ok = ok && (f == 0.5); |
| |
| // Postfix ++ 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-- == 2.5); |
| ok = ok && (f2.x == 1.5); |
| f2.x--; |
| ok = ok && (f2.x == 0.5); |
| |
| // Postfix ++ and -- (vector float). |
| f2++; |
| ok = ok && (f2++ == float2(1.5)); |
| ok = ok && (f2 == float2(2.5)); |
| ok = ok && (f2-- == float2(2.5)); |
| ok = ok && (f2 == float2(1.5)); |
| f2--; |
| ok = ok && (f2 == float2(0.5)); |
| |
| // Postfix ++ and -- (vector int). |
| int4 i4 = int4(7, 8, 9, 10); |
| i4++; |
| ok = ok && (i4++ == int4(8, 9, 10, 11)); |
| ok = ok && (i4 == int4(9, 10, 11, 12)); |
| ok = ok && (i4-- == int4(9, 10, 11, 12)); |
| ok = ok && (i4 == int4(8, 9, 10, 11)); |
| i4--; |
| ok = ok && (i4 == int4(7, 8, 9, 10)); |
| |
| // Postfix ++ and -- (matrix). |
| float3x3 m3x3 = float3x3(1, 2, 3, 4, 5, 6, 7, 8, 9); |
| m3x3++; |
| ok = ok && (m3x3++ == float3x3(2, 3, 4, 5, 6, 7, 8, 9, 10)); |
| ok = ok && (m3x3 == float3x3(3, 4, 5, 6, 7, 8, 9, 10, 11)); |
| ok = ok && (m3x3-- == float3x3(3, 4, 5, 6, 7, 8, 9, 10, 11)); |
| ok = ok && (m3x3 == float3x3(2, 3, 4, 5, 6, 7, 8, 9, 10)); |
| m3x3--; |
| ok = ok && (m3x3 == float3x3(1, 2, 3, 4, 5, 6, 7, 8, 9)); |
| |
| return ok ? colorGreen : colorRed; |
| } |