xref: /aosp_15_r20/external/skia/resources/sksl/intrinsics/Fract.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    const float4 expected = half4( 0.75, 0, 0.75, 0.25);
7
8    return (fract(testInputs.x)    == expected.x     &&
9            fract(testInputs.xy)   == expected.xy    &&
10            fract(testInputs.xyz)  == expected.xyz   &&
11            fract(testInputs.xyzw) == expected.xyzw  &&
12            fract(constVal.x)      == expected.x     &&
13            fract(constVal.xy)     == expected.xy    &&
14            fract(constVal.xyz)    == expected.xyz   &&
15            fract(constVal.xyzw)   == expected.xyzw) ? colorGreen : colorRed;
16}
17