skia2/tests/sksl/folding/FloatFolding.glsl

77 lines
1.5 KiB
Plaintext
Raw Normal View History

out vec4 sk_FragColor;
uniform vec4 colorRed;
uniform vec4 colorGreen;
bool test() {
bool ok = true;
float x = 34.0;
ok = ok && x == 34.0;
x = 30.0;
ok = ok && x == 30.0;
x = 64.0;
ok = ok && x == 64.0;
x = 16.0;
ok = ok && x == 16.0;
x = 19.0;
ok = ok && x == 19.0;
x = 1.0;
ok = ok && x == 1.0;
x = -2.0;
ok = ok && x == -2.0;
x = 3.0;
ok = ok && x == 3.0;
x = -4.0;
ok = ok && x == -4.0;
x = 5.0;
ok = ok && x == 5.0;
x = -6.0;
ok = ok && x == -6.0;
x = 7.0;
ok = ok && x == 7.0;
x = -8.0;
ok = ok && x == -8.0;
x = 9.0;
ok = ok && x == 9.0;
x = -10.0;
ok = ok && x == -10.0;
x = 11.0;
ok = ok && x == 11.0;
x = -12.0;
ok = ok && x == -12.0;
float unknown = sqrt(4.0);
x = unknown;
ok = ok && x == unknown;
x = unknown;
ok = ok && x == unknown;
x = unknown;
ok = ok && x == unknown;
x = 0.0;
ok = ok && x == 0.0;
x = unknown;
ok = ok && x == unknown;
x = unknown;
ok = ok && x == unknown;
x = 0.0;
ok = ok && x == 0.0;
x = unknown;
ok = ok && x == unknown;
x = 0.0;
ok = ok && x == 0.0;
x += 1.0;
ok = ok && x == 1.0;
ok = ok && x == 1.0;
x -= 2.0;
ok = ok && x == -1.0;
ok = ok && x == -1.0;
ok = ok && x == -1.0;
x *= 2.0;
ok = ok && x == -2.0;
ok = ok && x == -2.0;
x /= 2.0;
ok = ok && x == -1.0;
return ok;
}
vec4 main() {
return test() ? colorGreen : colorRed;
}