skia2/resources/sksl/intrinsics/AbsInt.sksl
John Stiles 0492a744a5 Add some SkSL intrinsics to our dm tests.
This CL adds dm coverage for:
- abs(half)
- sign(half)
- floor
- ceil

And creates test output for abs(int) and sign(int); these aren't covered
by dm because they don't exist in ES2 and so are unsupported by Runtime
Effects.

Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-28 21:20:00 +00:00

11 lines
380 B
Plaintext

uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
int4 expected = int4(1, 0, 0, 2);
return (abs(int4(testInputs).x) == expected.x &&
abs(int4(testInputs).xy) == expected.xy &&
abs(int4(testInputs).xyz) == expected.xyz &&
abs(int4(testInputs).xyzw) == expected.xyzw) ? colorGreen : colorRed;
}