skia2/tests/sksl/folding/FloatFolding.glsl
John Stiles 053f785903 Avoid relying on bit-perfect irrational numbers in test code.
Comparing sqrt(5) against a variable containing sqrt(5) was not working
properly in some versions of Android running Vulkan.

Change-Id: I4f6bbff78a9ba56ec6e222f2037d66b13e3cd635
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358530
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-25 21:27:19 +00:00

72 lines
1.5 KiB
GLSL

vec4 main() {
bool _1_ok = true;
float _2_x = 34.0;
_1_ok = true;
_2_x = 30.0;
_1_ok = true;
_2_x = 64.0;
_1_ok = true;
_2_x = 16.0;
_1_ok = true;
_2_x = 19.0;
_1_ok = true;
_2_x = 1.0;
_1_ok = true;
_2_x = -2.0;
_1_ok = true;
_2_x = 3.0;
_1_ok = true;
_2_x = -4.0;
_1_ok = true;
_2_x = 5.0;
_1_ok = true;
_2_x = -6.0;
_1_ok = true;
_2_x = 7.0;
_1_ok = true;
_2_x = -8.0;
_1_ok = true;
_2_x = 9.0;
_1_ok = true;
_2_x = -10.0;
_1_ok = true;
_2_x = 11.0;
_1_ok = true;
_2_x = -12.0;
_1_ok = true;
float _3_unknown = sqrt(4.0);
_2_x = _3_unknown;
_1_ok = _2_x == _3_unknown;
_2_x = _3_unknown;
_1_ok = _1_ok && _2_x == _3_unknown;
_2_x = _3_unknown;
_1_ok = _1_ok && _2_x == _3_unknown;
_2_x = 0.0;
_1_ok = _1_ok;
_2_x = _3_unknown;
_1_ok = _1_ok && _2_x == _3_unknown;
_2_x = _3_unknown;
_1_ok = _1_ok && _2_x == _3_unknown;
_2_x = 0.0;
_1_ok = _1_ok;
_2_x = _3_unknown;
_1_ok = _1_ok && _2_x == _3_unknown;
_2_x = 0.0;
_1_ok = _1_ok;
_2_x += 1.0;
_1_ok = _1_ok && _2_x == 1.0;
_1_ok = _1_ok && _2_x == 1.0;
_2_x -= 2.0;
_1_ok = _1_ok && _2_x == -1.0;
_1_ok = _1_ok && _2_x == -1.0;
_1_ok = _1_ok && _2_x == -1.0;
_2_x *= 2.0;
_1_ok = _1_ok && _2_x == -2.0;
_1_ok = _1_ok && _2_x == -2.0;
_2_x /= 2.0;
_1_ok = _1_ok && _2_x == -1.0;
return _1_ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
}