skia2/resources/sksl/intrinsics/GreaterThanEqual.sksl
John Stiles 1dc2d0fe0f Allow compile-time intrinsic evaluation to read const variables.
Previously, the code neglected to resolve constant variables into
values. This meant that expressions like `lessThan(zero, one)` could not
be compile-time evaluated even when `zero` and `one` have known values.

Change-Id: I2f5ce303e3dcc682be14e4d2485e24dd7c59212e
Bug: skia:10835
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405536
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-05-07 13:36:08 +00:00

14 lines
495 B
Plaintext

uniform half4 a, b;
uniform uint2 c, d;
uniform int3 e, f;
void main() {
const int4 int4_zero = int4(0);
bool4 expectFFTT = greaterThanEqual(half4(1, 2, 2.25, 2.5), half4(2.25));
bool4 expectTTFF = greaterThanEqual(int4_zero, int4(-50, 0, 50, 100));
sk_FragColor.x = greaterThanEqual(a, b).x ? 1 : 0;
sk_FragColor.y = greaterThanEqual(c, d).y ? 1 : 0;
sk_FragColor.z = greaterThanEqual(e, f).z ? 1 : 0;
sk_FragColor.w = any(expectTTFF) || any(expectFFTT) ? 1 : 0;
}