xref: /aosp_15_r20/external/skia/resources/sksl/intrinsics/MinFloat.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform float4 testInputs;
2uniform half4 colorGreen, colorRed;
3
4half4 main(float2 coords) {
5    float4 expectedA = half4(-1.25, 0, 0.5, 0.5);
6    float4 expectedB = half4(-1.25, 0, 0, 1);
7    const float4 constVal   = half4(-1.25, 0, 0.75, 2.25);
8    const float4 constGreen = half4(0, 1, 0, 1);
9    return (min(testInputs.x,    0.5)             == expectedA.x     &&
10            min(testInputs.xy,   0.5)             == expectedA.xy    &&
11            min(testInputs.xyz,  0.5)             == expectedA.xyz   &&
12            min(testInputs.xyzw, 0.5)             == expectedA.xyzw  &&
13            min(constVal.x,      0.5)             == expectedA.x     &&
14            min(constVal.xy,     0.5)             == expectedA.xy    &&
15            min(constVal.xyz,    0.5)             == expectedA.xyz   &&
16            min(constVal.xyzw,   0.5)             == expectedA.xyzw  &&
17            min(testInputs.x,    colorGreen.x)    == expectedB.x     &&
18            min(testInputs.xy,   colorGreen.xy)   == expectedB.xy    &&
19            min(testInputs.xyz,  colorGreen.xyz)  == expectedB.xyz   &&
20            min(testInputs.xyzw, colorGreen.xyzw) == expectedB.xyzw  &&
21            min(constVal.x,      constGreen.x)    == expectedB.x     &&
22            min(constVal.xy,     constGreen.xy)   == expectedB.xy    &&
23            min(constVal.xyz,    constGreen.xyz)  == expectedB.xyz   &&
24            min(constVal.xyzw,   constGreen.xyzw) == expectedB.xyzw) ? colorGreen : colorRed;
25}
26