xref: /aosp_15_r20/external/skia/tests/sksl/shared/Assignment.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    float f;
9    array<float, 5> af;
10    half4 h4;
11    array<half4, 5> ah4;
12};
13struct Uniforms {
14    half4 colorGreen;
15};
16struct Inputs {
17};
18struct Outputs {
19    half4 sk_FragColor [[color(0)]];
20};
21struct Globals {
22    half4 globalVar;
23    S globalStruct;
24};
25void keepAlive_vh(thread half& h) {
26}
27void keepAlive_vf(thread float& f) {
28}
29void keepAlive_vi(thread int& i) {
30}
31void assignToFunctionParameter_vif(int x, thread float& y) {
32    x = 1;
33    y = 1.0;
34}
35fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
36    Globals _globals{{}, {}};
37    (void)_globals;
38    Outputs _out;
39    (void)_out;
40    float _skTemp0;
41    float _skTemp1;
42    half _skTemp2;
43    int _skTemp3;
44    int _skTemp4;
45    int _skTemp5;
46    int _skTemp6;
47    half _skTemp7;
48    float _skTemp8;
49    half _skTemp9;
50    float _skTemp10;
51    float _skTemp11;
52    int i = 0;
53    int4 i4 = int4(1, 2, 3, 4);
54    float3x3 f3x3 = float3x3(float3(1.0, 2.0, 3.0), float3(4.0, 5.0, 6.0), float3(7.0, 8.0, 9.0));
55    half4 x;
56    x.w = 0.0h;
57    x.yx = half2(0.0h);
58    array<int, 1> ai;
59    ai[0] = 0;
60    array<int4, 1> ai4;
61    ai4[0] = int4(1, 2, 3, 4);
62    array<half3x3, 1> ah3x3;
63    ah3x3[0] = half3x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h));
64    array<float4, 1> af4;
65    af4[0].x = 0.0;
66    af4[0].ywxz = float4(1.0);
67    S s;
68    s.f = 0.0;
69    s.af[1] = 0.0;
70    s.h4.zxy = half3(9.0h);
71    s.ah4[2].yw = half2(5.0h);
72    _globals.globalVar = half4(0.0h);
73    _globals.globalStruct.f = 0.0;
74    ((assignToFunctionParameter_vif(0, (_skTemp0 = f3x3[0].x))), (f3x3[0].x = _skTemp0));
75    half l;
76    l = 0.0h;
77    ai[0] += ai4[0].x;
78    s.f = 1.0;
79    s.af[0] = 2.0;
80    s.h4 = half4(1.0h);
81    s.ah4[0] = half4(2.0h);
82    float repeat;
83    repeat = (repeat = 1.0);
84    ((keepAlive_vf((_skTemp1 = af4[0].x))), (af4[0].x = _skTemp1));
85    ((keepAlive_vh((_skTemp2 = ah3x3[0][0].x))), (ah3x3[0][0].x = _skTemp2));
86    ((keepAlive_vi((_skTemp3 = i))), (i = _skTemp3));
87    ((keepAlive_vi((_skTemp4 = i4.y))), (i4.y = _skTemp4));
88    ((keepAlive_vi((_skTemp5 = ai[0]))), (ai[0] = _skTemp5));
89    ((keepAlive_vi((_skTemp6 = ai4[0].x))), (ai4[0].x = _skTemp6));
90    ((keepAlive_vh((_skTemp7 = x.y))), (x.y = _skTemp7));
91    ((keepAlive_vf((_skTemp8 = s.f))), (s.f = _skTemp8));
92    ((keepAlive_vh((_skTemp9 = l))), (l = _skTemp9));
93    ((keepAlive_vf((_skTemp10 = f3x3[0].x))), (f3x3[0].x = _skTemp10));
94    ((keepAlive_vf((_skTemp11 = repeat))), (repeat = _skTemp11));
95    _out.sk_FragColor = _uniforms.colorGreen;
96    return _out;
97}
98