1cb93a386Sopenharmony_ci#include <metal_stdlib>
2cb93a386Sopenharmony_ci#include <simd/simd.h>
3cb93a386Sopenharmony_ciusing namespace metal;
4cb93a386Sopenharmony_cistruct Uniforms {
5cb93a386Sopenharmony_ci    half4 colorGreen;
6cb93a386Sopenharmony_ci    half4 colorRed;
7cb93a386Sopenharmony_ci};
8cb93a386Sopenharmony_cistruct Inputs {
9cb93a386Sopenharmony_ci};
10cb93a386Sopenharmony_cistruct Outputs {
11cb93a386Sopenharmony_ci    half4 sk_FragColor [[color(0)]];
12cb93a386Sopenharmony_ci};
13cb93a386Sopenharmony_cifloat3x3 float3x3_from_float2x3(float2x3 x0) {
14cb93a386Sopenharmony_ci    return float3x3(float3(x0[0].xyz), float3(x0[1].xyz), float3(0.0, 0.0, 1.0));
15cb93a386Sopenharmony_ci}
16cb93a386Sopenharmony_cifloat3x3 float3x3_from_float3x2(float3x2 x0) {
17cb93a386Sopenharmony_ci    return float3x3(float3(x0[0].xy, 0.0), float3(x0[1].xy, 0.0), float3(x0[2].xy, 1.0));
18cb93a386Sopenharmony_ci}
19cb93a386Sopenharmony_cifloat4x4 float4x4_from_float4x3(float4x3 x0) {
20cb93a386Sopenharmony_ci    return float4x4(float4(x0[0].xyz, 0.0), float4(x0[1].xyz, 0.0), float4(x0[2].xyz, 0.0), float4(x0[3].xyz, 1.0));
21cb93a386Sopenharmony_ci}
22cb93a386Sopenharmony_cifloat4x3 float4x3_from_float4x2(float4x2 x0) {
23cb93a386Sopenharmony_ci    return float4x3(float3(x0[0].xy, 0.0), float3(x0[1].xy, 0.0), float3(x0[2].xy, 1.0), float3(x0[3].xy, 0.0));
24cb93a386Sopenharmony_ci}
25cb93a386Sopenharmony_cifloat4x4 float4x4_from_float3x4(float3x4 x0) {
26cb93a386Sopenharmony_ci    return float4x4(float4(x0[0].xyzw), float4(x0[1].xyzw), float4(x0[2].xyzw), float4(0.0, 0.0, 0.0, 1.0));
27cb93a386Sopenharmony_ci}
28cb93a386Sopenharmony_cifloat3x4 float3x4_from_float2x4(float2x4 x0) {
29cb93a386Sopenharmony_ci    return float3x4(float4(x0[0].xyzw), float4(x0[1].xyzw), float4(0.0, 0.0, 1.0, 0.0));
30cb93a386Sopenharmony_ci}
31cb93a386Sopenharmony_cifloat2x4 float2x4_from_float4x2(float4x2 x0) {
32cb93a386Sopenharmony_ci    return float2x4(float4(x0[0].xy, 0.0, 0.0), float4(x0[1].xy, 0.0, 0.0));
33cb93a386Sopenharmony_ci}
34cb93a386Sopenharmony_cifloat4x2 float4x2_from_float2x4(float2x4 x0) {
35cb93a386Sopenharmony_ci    return float4x2(float2(x0[0].xy), float2(x0[1].xy), float2(0.0, 0.0), float2(0.0, 0.0));
36cb93a386Sopenharmony_ci}
37cb93a386Sopenharmony_cifragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
38cb93a386Sopenharmony_ci    Outputs _out;
39cb93a386Sopenharmony_ci    (void)_out;
40cb93a386Sopenharmony_ci    float result = 0.0;
41cb93a386Sopenharmony_ci    float3x3 g = float3x3_from_float2x3(float2x3(1.0));
42cb93a386Sopenharmony_ci    result += g[0].x;
43cb93a386Sopenharmony_ci    float3x3 h = float3x3_from_float3x2(float3x2(1.0));
44cb93a386Sopenharmony_ci    result += h[0].x;
45cb93a386Sopenharmony_ci    float4x4 i = float4x4_from_float4x3(float4x3_from_float4x2(float4x2(1.0)));
46cb93a386Sopenharmony_ci    result += i[0].x;
47cb93a386Sopenharmony_ci    float4x4 j = float4x4_from_float3x4(float3x4_from_float2x4(float2x4(1.0)));
48cb93a386Sopenharmony_ci    result += j[0].x;
49cb93a386Sopenharmony_ci    float2x4 k = float2x4_from_float4x2(float4x2(1.0));
50cb93a386Sopenharmony_ci    result += k[0].x;
51cb93a386Sopenharmony_ci    float4x2 l = float4x2_from_float2x4(float2x4(1.0));
52cb93a386Sopenharmony_ci    result += l[0].x;
53cb93a386Sopenharmony_ci    _out.sk_FragColor = result == 6.0 ? _uniforms.colorGreen : _uniforms.colorRed;
54cb93a386Sopenharmony_ci    return _out;
55cb93a386Sopenharmony_ci}
56