xref: /aosp_15_r20/external/skia/resources/sksl/intrinsics/AbsFloat.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform float4 testInputs;  // equals (-1.25, 0, 0.75, 2.25)
2uniform half4 colorGreen, colorRed;
3
4half4 main(float2 coords) {
5    const float4 constVal = half4(-1.25, 0, 0.75, 2.25);
6    float4 expected = half4(1.25, 0, 0.75, 2.25);
7    return (abs(testInputs.x)    == expected.x     &&
8            abs(testInputs.xy)   == expected.xy    &&
9            abs(testInputs.xyz)  == expected.xyz   &&
10            abs(testInputs.xyzw) == expected.xyzw  &&
11            abs(constVal.x)      == expected.x     &&
12            abs(constVal.xy)     == expected.xy    &&
13            abs(constVal.xyz)    == expected.xyz   &&
14            abs(constVal.xyzw)   == expected.xyzw) ? colorGreen : colorRed;
15}
16