xref: /aosp_15_r20/external/skia/resources/sksl/intrinsics/MaxUint.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform half4 testInputs;
2uniform half4 colorGreen, colorRed;
3
4half4 main(float2 coords) {
5    uint4 uintValues = uint4(abs(testInputs) * 100);
6    uint4 uintGreen  = uint4(colorGreen * 100);
7    const uint4 constVal = uint4(125, 0, 75, 225);
8    const uint4 constGreen = uint4(0, 100, 0, 100);
9
10    uint4 expectedA = uint4(125, 80, 80, 225);
11    uint4 expectedB = uint4(125, 100, 75, 225);
12    return (max(uintValues.x,    80)              == expectedA.x     &&
13            max(uintValues.xy,   80)              == expectedA.xy    &&
14            max(uintValues.xyz,  80)              == expectedA.xyz   &&
15            max(uintValues.xyzw, 80)              == expectedA.xyzw  &&
16            max(constVal.x,      80)              == expectedA.x     &&
17            max(constVal.xy,     80)              == expectedA.xy    &&
18            max(constVal.xyz,    80)              == expectedA.xyz   &&
19            max(constVal.xyzw,   80)              == expectedA.xyzw  &&
20            max(uintValues.x,    uintGreen.x)     == expectedB.x     &&
21            max(uintValues.xy,   uintGreen.xy)    == expectedB.xy    &&
22            max(uintValues.xyz,  uintGreen.xyz)   == expectedB.xyz   &&
23            max(uintValues.xyzw, uintGreen.xyzw)  == expectedB.xyzw  &&
24            max(constVal.x,      constGreen.x)    == expectedB.x     &&
25            max(constVal.xy,     constGreen.xy)   == expectedB.xy    &&
26            max(constVal.xyz,    constGreen.xyz)  == expectedB.xyz   &&
27            max(constVal.xyzw,   constGreen.xyzw) == expectedB.xyzw) ? colorGreen : colorRed;
28}
29