skia2/resources/sksl/intrinsics/Tan.sksl
John Stiles 115645ee9b Evaluate various single-argument float intrinsics at compile time.
This CL only handles a subset of our intrinsics. In particular, it
avoids changing the behavior of `sqrt` as many of our tests use sqrt as
an optimization barrier.

The transcendental test inputs are intentionally kept very simple to
avoid putting numbers in the test outputs which could round differently
on various platforms and cause Housekeeper to complain.

Change-Id: I539f918294332310dcd6fe12fab163c0b6216f65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405398
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-05-07 14:37:18 +00:00

15 lines
573 B
Plaintext

uniform half4 input, expected;
uniform half4 colorGreen, colorRed;
half4 main(float2 coords) {
const half4 constVal = half4(0);
return (tan(input.x) == expected.x &&
tan(input.xy) == expected.xy &&
tan(input.xyz) == expected.xyz &&
tan(input.xyzw) == expected.xyzw &&
tan(constVal.x) == expected.x &&
tan(constVal.xy) == expected.xy &&
tan(constVal.xyz) == expected.xyz &&
tan(constVal.xyzw) == expected.xyzw) ? colorGreen : colorRed;
}