• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1uniform half4 colorRed, colorGreen;
2
3bool test() {
4    bool ok = true;
5    int x = 12 | 6;
6    ok = ok && (x == 14);
7    x = 254 & 7;
8    ok = ok && (x == 6);
9    x = 2 ^ 7;
10    ok = ok && (x == 5);
11    x = 1 << 4;
12    ok = ok && (x == 16);
13    // Left-shifting a negative integer is undefined in C++, but allowed in GPU shading languages.
14    // https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29093
15    x = -2 << 2;
16    ok = ok && (x == -8);
17    x = 128 >> 2;
18    ok = ok && (x == 32);
19    x = 123 % 45;
20    ok = ok && (x == 33);
21    return ok;
22}
23
24half4 main(float2 coords) {
25    return test() ? colorGreen : colorRed;
26}
27