xref: /aosp_15_r20/external/skia/gm/DATA/skia_resources/sksl/intrinsics/Inversesqrt.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform half4 inputVal, expected;
2uniform half4 colorGreen, colorRed;
3
4half4 main(float2 coords) {
5    const half4 constVal = half4(1, 4, 16, 64);
6    const half4 negativeVal = half4(-1, -4, -16, -64);  // should not optimize away
7    return (inversesqrt(inputVal.x)       == expected.x     &&
8            inversesqrt(inputVal.xy)      == expected.xy    &&
9            inversesqrt(inputVal.xyz)     == expected.xyz   &&
10            inversesqrt(inputVal.xyzw)    == expected.xyzw  &&
11            inversesqrt(constVal.x)       == expected.x     &&
12            inversesqrt(constVal.xy)      == expected.xy    &&
13            inversesqrt(constVal.xyz)     == expected.xyz   &&
14            inversesqrt(constVal.xyzw)    == expected.xyzw  &&
15            inversesqrt(negativeVal.x)    == expected.x     &&
16            inversesqrt(negativeVal.xy)   == expected.xy    &&
17            inversesqrt(negativeVal.xyz)  == expected.xyz   &&
18            inversesqrt(negativeVal.xyzw) == expected.xyzw) ? colorGreen : colorRed;
19}
20