xref: /aosp_15_r20/external/skia/tests/sksl/intrinsics/LessThan.metal (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1#include <metal_stdlib>
2#include <simd/simd.h>
3#ifdef __clang__
4#pragma clang diagnostic ignored "-Wall"
5#endif
6using namespace metal;
7struct Uniforms {
8    half4 a;
9    half4 b;
10    uint2 c;
11    uint2 d;
12    int3 e;
13    int3 f;
14};
15struct Inputs {
16};
17struct Outputs {
18    half4 sk_FragColor [[color(0)]];
19};
20fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
21    Outputs _out;
22    (void)_out;
23    bool4 expectTTFF = bool4(true, true, false, false);
24    bool4 expectFFTT = bool4(false, false, true, true);
25    _out.sk_FragColor.x = half((_uniforms.a < _uniforms.b).x);
26    _out.sk_FragColor.y = half((_uniforms.c < _uniforms.d).y);
27    _out.sk_FragColor.z = half((_uniforms.e < _uniforms.f).z);
28    _out.sk_FragColor.w = half(any(expectTTFF) || any(expectFFTT));
29    return _out;
30}
31