xref: /aosp_15_r20/external/skia/tests/sksl/shared/OperatorsES3.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 colorGreen;
9    half4 colorRed;
10    float unknownInput;
11};
12struct Inputs {
13};
14struct Outputs {
15    half4 sk_FragColor [[color(0)]];
16};
17fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
18    Outputs _out;
19    (void)_out;
20    float x = 1.0;
21    float y = 2.0;
22    int z = 3;
23    x = (x - x) + ((y * x) * x) * (y - x);
24    y = (x / y) / x;
25    z = (((z / 2) % 3 << 4) >> 2) << 1;
26    bool b = x > 4.0 == x < 2.0 || 2.0 >= _uniforms.unknownInput && y <= x;
27    bool c = _uniforms.unknownInput > 2.0;
28    bool d = b != c;
29    bool e = b && c;
30    bool f = b || c;
31    x += 12.0;
32    x -= 12.0;
33    x *= (y *= 0.1);
34    z |= 0;
35    z &= -1;
36    z ^= 0;
37    z >>= 2;
38    z <<= 4;
39    z %= 5;
40    x = float((_uniforms.colorGreen.xy, 6));
41    y = float(((((float(b) * float(c)) * float(d)) * float(e)) * float(f), 6.0));
42    z = int((_uniforms.colorRed.zw, 6));
43    int2 w = int2(-6);
44    w = ~w;
45    _out.sk_FragColor = (((w.x == 5 && w.y == 5) && x == 6.0) && y == 6.0) && z == 6 ? _uniforms.colorGreen : _uniforms.colorRed;
46    return _out;
47}
48