2021-01-26 21:28:12 +00:00
|
|
|
uniform half4 colorRed, colorGreen;
|
|
|
|
|
2021-01-22 14:51:13 +00:00
|
|
|
bool test() {
|
|
|
|
bool ok = true;
|
|
|
|
int x = 12 | 6;
|
|
|
|
ok = ok && (x == 14);
|
|
|
|
x = 254 & 7;
|
|
|
|
ok = ok && (x == 6);
|
|
|
|
x = 2 ^ 7;
|
|
|
|
ok = ok && (x == 5);
|
|
|
|
x = 1 << 4;
|
|
|
|
ok = ok && (x == 16);
|
2021-02-01 16:43:05 +00:00
|
|
|
// Left-shifting a negative integer is undefined in C++, but allowed in GPU shading languages.
|
|
|
|
// https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29093
|
|
|
|
x = -2 << 2;
|
|
|
|
ok = ok && (x == -8);
|
2021-01-22 14:51:13 +00:00
|
|
|
x = 128 >> 2;
|
|
|
|
ok = ok && (x == 32);
|
|
|
|
x = 123 % 45;
|
|
|
|
ok = ok && (x == 33);
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2021-04-21 18:27:08 +00:00
|
|
|
half4 main(float2 coords) {
|
2021-01-26 21:28:12 +00:00
|
|
|
return test() ? colorGreen : colorRed;
|
2021-01-22 14:51:13 +00:00
|
|
|
}
|