xref: /aosp_15_r20/external/skia/tests/sksl/shared/OperatorsES2.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    half 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;
26    bool b = x > 4.0 == x < 2.0 || 2.0h >= _uniforms.unknownInput && y <= x;
27    bool c = _uniforms.unknownInput > 2.0h;
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    x = 6.0;
35    y = (((float(b) * float(c)) * float(d)) * float(e)) * float(f);
36    y = 6.0;
37    z = z - 1;
38    z = 6;
39    _out.sk_FragColor = (x == 6.0 && y == 6.0) && z == 6 ? _uniforms.colorGreen : _uniforms.colorRed;
40    return _out;
41}
42