xref: /aosp_15_r20/external/skia/tests/sksl/shared/InoutParamsAreDistinct.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};
11struct Inputs {
12};
13struct Outputs {
14    half4 sk_FragColor [[color(0)]];
15};
16bool inout_params_are_distinct_bhh(thread half& x, thread half& y) {
17    x = 1.0h;
18    y = 2.0h;
19    return x == 1.0h && y == 2.0h;
20}
21fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
22    Outputs _out;
23    (void)_out;
24    half _skTemp0;
25    half _skTemp1;
26    bool _skTemp2;
27    half x = 0.0h;
28    _out.sk_FragColor = ((_skTemp2 = inout_params_are_distinct_bhh((_skTemp0 = x), (_skTemp1 = x))), (x = _skTemp0), (x = _skTemp1), _skTemp2) ? _uniforms.colorGreen : _uniforms.colorRed;
29    return _out;
30}
31