xref: /aosp_15_r20/external/skia/resources/sksl/intrinsics/MaxInt.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    int4 intValues = int4(testInputs * 100);
6*c8dee2aaSAndroid Build Coastguard Worker    int4 intGreen  = int4(colorGreen * 100);
7*c8dee2aaSAndroid Build Coastguard Worker    const int4 constVal = int4(-125, 0, 75, 225);
8*c8dee2aaSAndroid Build Coastguard Worker    const int4 constGreen = int4(0, 100, 0, 100);
9*c8dee2aaSAndroid Build Coastguard Worker
10*c8dee2aaSAndroid Build Coastguard Worker    int4 expectedA = int4(50, 50, 75, 225);
11*c8dee2aaSAndroid Build Coastguard Worker    int4 expectedB = int4(0, 100, 75, 225);
12*c8dee2aaSAndroid Build Coastguard Worker    return (max(intValues.x,    50)              == expectedA.x     &&
13*c8dee2aaSAndroid Build Coastguard Worker            max(intValues.xy,   50)              == expectedA.xy    &&
14*c8dee2aaSAndroid Build Coastguard Worker            max(intValues.xyz,  50)              == expectedA.xyz   &&
15*c8dee2aaSAndroid Build Coastguard Worker            max(intValues.xyzw, 50)              == expectedA.xyzw  &&
16*c8dee2aaSAndroid Build Coastguard Worker            max(constVal.x,     50)              == expectedA.x     &&
17*c8dee2aaSAndroid Build Coastguard Worker            max(constVal.xy,    50)              == expectedA.xy    &&
18*c8dee2aaSAndroid Build Coastguard Worker            max(constVal.xyz,   50)              == expectedA.xyz   &&
19*c8dee2aaSAndroid Build Coastguard Worker            max(constVal.xyzw,  50)              == expectedA.xyzw  &&
20*c8dee2aaSAndroid Build Coastguard Worker            max(intValues.x,    intGreen.x)      == expectedB.x     &&
21*c8dee2aaSAndroid Build Coastguard Worker            max(intValues.xy,   intGreen.xy)     == expectedB.xy    &&
22*c8dee2aaSAndroid Build Coastguard Worker            max(intValues.xyz,  intGreen.xyz)    == expectedB.xyz   &&
23*c8dee2aaSAndroid Build Coastguard Worker            max(intValues.xyzw, intGreen.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