xref: /aosp_15_r20/external/skia/tests/sksl/shared/ScopedSymbol.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 S {
8    int i;
9};
10struct Uniforms {
11    half4 colorGreen;
12    half4 colorRed;
13};
14struct Inputs {
15};
16struct Outputs {
17    half4 sk_FragColor [[color(0)]];
18};
19struct Globals {
20    int glob;
21};
22bool block_variable_hides_global_variable_b(thread Globals& _globals) {
23    return _globals.glob == 2;
24}
25bool local_variable_hides_struct_b() {
26    bool S = true;
27    return S;
28}
29bool local_struct_variable_hides_struct_type_b() {
30    S S = S{1};
31    return S.i == 1;
32}
33bool local_variable_hides_global_variable_b() {
34    int glob = 1;
35    return glob == 1;
36}
37fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
38    Globals _globals{{}};
39    (void)_globals;
40    Outputs _out;
41    (void)_out;
42    _globals.glob = 2;
43    const bool _0_var = true;
44    _out.sk_FragColor = (((_0_var && block_variable_hides_global_variable_b(_globals)) && local_variable_hides_struct_b()) && local_struct_variable_hides_struct_type_b()) && local_variable_hides_global_variable_b() ? _uniforms.colorGreen : _uniforms.colorRed;
45    return _out;
46}
47