xref: /aosp_15_r20/external/skia/resources/sksl/intrinsics/MinUint.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(50, 0, 50, 50);
11    uint4 expectedB = uint4(0, 0, 0, 100);
12    return (min(uintValues.x,    50)              == expectedA.x     &&
13            min(uintValues.xy,   50)              == expectedA.xy    &&
14            min(uintValues.xyz,  50)              == expectedA.xyz   &&
15            min(uintValues.xyzw, 50)              == expectedA.xyzw  &&
16            min(constVal.x,      50)              == expectedA.x     &&
17            min(constVal.xy,     50)              == expectedA.xy    &&
18            min(constVal.xyz,    50)              == expectedA.xyz   &&
19            min(constVal.xyzw,   50)              == expectedA.xyzw  &&
20            min(uintValues.x,    uintGreen.x)     == expectedB.x     &&
21            min(uintValues.xy,   uintGreen.xy)    == expectedB.xy    &&
22            min(uintValues.xyz,  uintGreen.xyz)   == expectedB.xyz   &&
23            min(uintValues.xyzw, uintGreen.xyzw)  == expectedB.xyzw  &&
24            min(constVal.x,      constGreen.x)    == expectedB.x     &&
25            min(constVal.xy,     constGreen.xy)   == expectedB.xy    &&
26            min(constVal.xyz,    constGreen.xyz)  == expectedB.xyz   &&
27            min(constVal.xyzw,   constGreen.xyzw) == expectedB.xyzw) ? colorGreen : colorRed;
28}
29