skia2/tests/sksl/folding/FloatFolding.glsl
John Stiles c332739531 Remove 0/x arithmetic simplification.
If x is a known compile-time constant value, it can already be optimized
to a final value.
If x is not known, it could be zero, and 0/0 should result in a NaN.

Change-Id: I643a7c6da0a43ec366235c4df39fc78d3b361de7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441580
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-08-24 19:18:41 +00:00

75 lines
1.9 KiB
GLSL

out vec4 sk_FragColor;
uniform vec4 colorRed;
uniform vec4 colorGreen;
uniform float unknownInput;
vec4 main() {
float _0_unknown = unknownInput;
bool _1_ok = true;
float _2_x = 34.0;
_1_ok = _1_ok && _2_x == 34.0;
_2_x = 30.0;
_1_ok = _1_ok && _2_x == 30.0;
_2_x = 64.0;
_1_ok = _1_ok && _2_x == 64.0;
_2_x = 16.0;
_1_ok = _1_ok && _2_x == 16.0;
_2_x = 19.0;
_1_ok = _1_ok && _2_x == 19.0;
_2_x = 1.0;
_1_ok = _1_ok && _2_x == 1.0;
_2_x = -2.0;
_1_ok = _1_ok && _2_x == -2.0;
_2_x = 3.0;
_1_ok = _1_ok && _2_x == 3.0;
_2_x = -4.0;
_1_ok = _1_ok && _2_x == -4.0;
_2_x = 5.0;
_1_ok = _1_ok && _2_x == 5.0;
_2_x = -6.0;
_1_ok = _1_ok && _2_x == -6.0;
_2_x = 7.0;
_1_ok = _1_ok && _2_x == 7.0;
_2_x = -8.0;
_1_ok = _1_ok && _2_x == -8.0;
_2_x = 9.0;
_1_ok = _1_ok && _2_x == 9.0;
_2_x = -10.0;
_1_ok = _1_ok && _2_x == -10.0;
_2_x = 11.0;
_1_ok = _1_ok && _2_x == 11.0;
_2_x = -12.0;
_1_ok = _1_ok && _2_x == -12.0;
_2_x = _0_unknown;
_1_ok = _1_ok && _2_x == _0_unknown;
_2_x = _0_unknown;
_1_ok = _1_ok && _2_x == _0_unknown;
_2_x = _0_unknown;
_1_ok = _1_ok && _2_x == _0_unknown;
_2_x = 0.0;
_1_ok = _1_ok && _2_x == 0.0;
_2_x = _0_unknown;
_1_ok = _1_ok && _2_x == _0_unknown;
_2_x = _0_unknown;
_1_ok = _1_ok && _2_x == _0_unknown;
_2_x = 0.0;
_1_ok = _1_ok && _2_x == 0.0;
_2_x = _0_unknown;
_1_ok = _1_ok && _2_x == _0_unknown;
_2_x = 0.0 / _0_unknown;
_1_ok = _1_ok && _2_x == 0.0;
_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 ? colorGreen : colorRed;
}