xref: /aosp_15_r20/external/skia/resources/sksl/shared/NestedComparisonIntrinsics.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Workeruniform half4 colorRed, colorGreen;
2*c8dee2aaSAndroid Build Coastguard Worker
3*c8dee2aaSAndroid Build Coastguard Workerhalf4 main(float2 coords) {
4*c8dee2aaSAndroid Build Coastguard Worker    // The inner comparisons against colors should evaluate to true in every component.
5*c8dee2aaSAndroid Build Coastguard Worker    // The outer comparison should evaluate to `true == true`, so is true in each channel.
6*c8dee2aaSAndroid Build Coastguard Worker    bool4 result = equal(lessThan(colorRed, half4(2.0)),
7*c8dee2aaSAndroid Build Coastguard Worker                         greaterThan(half4(3.0), colorGreen));
8*c8dee2aaSAndroid Build Coastguard Worker
9*c8dee2aaSAndroid Build Coastguard Worker    return all(result) ? colorGreen : colorRed;
10*c8dee2aaSAndroid Build Coastguard Worker}
11