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