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