skia2/resources/sksl/intrinsics/Atanh.sksl
John Stiles 1049d82061 Add ES3 Angle and Trigonometry methods to sksl_public.
This adds sinh, cosh, tanh, asinh, acosh, and atanh. We now also support
compile-time optimization for the arc functions.

Change-Id: I688f579b50403db534622b82926aa20d1f445341
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439319
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-08-13 20:57:44 +00:00

15 lines
661 B
Plaintext

uniform half4 input, expected;
uniform half4 colorGreen, colorRed;
half4 main(float2 coords) {
const half4 constVal1 = half4(0, 0.2449186624037091292, 0.46211715726000975, 0.761594155955764);
return (atanh(input.x) == expected.x &&
atanh(input.xy) == expected.xy &&
atanh(input.xyz) == expected.xyz &&
atanh(input.xyzw) == expected.xyzw &&
atanh(constVal1.x) == expected.x &&
atanh(constVal1.xy) == expected.xy &&
atanh(constVal1.xyz) == expected.xyz &&
atanh(constVal1.xyzw) == expected.xyzw) ? colorGreen : colorRed;
}