1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Inputs {
5    float2 vLocalCoord_Stage0  [[user(locn0)]];
6};
7struct Outputs {
8    float4 sk_FragColor [[color(0)]];
9};
10struct uniformBuffer {
11    float4 sk_RTAdjust;
12    float2 uIncrement_Stage1_c0;
13    char pad0[8];
14    array<float4, 7> uKernel_Stage1_c0;
15    float3x3 umatrix_Stage1_c0_c0;
16    float4 uborder_Stage1_c0_c0_c0;
17    float4 usubset_Stage1_c0_c0_c0;
18    float4 unorm_Stage1_c0_c0_c0;
19};
20struct Globals {
21    constant uniformBuffer* _anonInterface0;
22    texture2d<float> uTextureSampler_0_Stage1;
23    sampler uTextureSampler_0_Stage1Smplr;
24};
25float4 MatrixEffect_Stage1_c0_c0_h4h4f2(thread Globals& _globals, float4 _input, float2 _coords) {
26    float2 _1_inCoord = (_globals._anonInterface0->umatrix_Stage1_c0_c0 * float3(_coords, 1.0)).xy;
27    _1_inCoord *= _globals._anonInterface0->unorm_Stage1_c0_c0_c0.xy;
28    float2 _2_subsetCoord;
29    _2_subsetCoord.x = _1_inCoord.x;
30    _2_subsetCoord.y = _1_inCoord.y;
31    float2 _3_clampedCoord;
32    _3_clampedCoord = _2_subsetCoord;
33    float4 _4_textureColor = _globals.uTextureSampler_0_Stage1.sample(_globals.uTextureSampler_0_Stage1Smplr, _3_clampedCoord * _globals._anonInterface0->unorm_Stage1_c0_c0_c0.zw);
34    float _5_snappedX = floor(_1_inCoord.x + 0.0010000000474974513) + 0.5;
35    if (_5_snappedX < _globals._anonInterface0->usubset_Stage1_c0_c0_c0.x || _5_snappedX > _globals._anonInterface0->usubset_Stage1_c0_c0_c0.z) {
36        _4_textureColor = _globals._anonInterface0->uborder_Stage1_c0_c0_c0;
37    }
38    return _4_textureColor;
39}
40fragment Outputs fragmentMain(Inputs _in [[stage_in]], texture2d<float> uTextureSampler_0_Stage1[[texture(0)]], sampler uTextureSampler_0_Stage1Smplr[[sampler(0)]], constant uniformBuffer& _anonInterface0 [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
41    Globals _globals{&_anonInterface0, uTextureSampler_0_Stage1, uTextureSampler_0_Stage1Smplr};
42    (void)_globals;
43    Outputs _out;
44    (void)_out;
45    float4 outputColor_Stage0;
46    float4 outputCoverage_Stage0;
47    {
48        outputColor_Stage0 = float4(1.0);
49        outputCoverage_Stage0 = float4(1.0);
50    }
51    float4 output_Stage1;
52    float4 _6_output;
53    _6_output = float4(0.0, 0.0, 0.0, 0.0);
54    float2 _7_coord = _in.vLocalCoord_Stage0 - 12.0 * _globals._anonInterface0->uIncrement_Stage1_c0;
55    float2 _8_coordSampled = float2(0.0, 0.0);
56    _8_coordSampled = _7_coord;
57    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].x;
58    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
59    _8_coordSampled = _7_coord;
60    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].y;
61    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
62    _8_coordSampled = _7_coord;
63    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].z;
64    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
65    _8_coordSampled = _7_coord;
66    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].w;
67    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
68    _8_coordSampled = _7_coord;
69    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].x;
70    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
71    _8_coordSampled = _7_coord;
72    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].y;
73    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
74    _8_coordSampled = _7_coord;
75    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].z;
76    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
77    _8_coordSampled = _7_coord;
78    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].w;
79    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
80    _8_coordSampled = _7_coord;
81    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].x;
82    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
83    _8_coordSampled = _7_coord;
84    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].y;
85    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
86    _8_coordSampled = _7_coord;
87    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].z;
88    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
89    _8_coordSampled = _7_coord;
90    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].w;
91    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
92    _8_coordSampled = _7_coord;
93    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].x;
94    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
95    _8_coordSampled = _7_coord;
96    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].y;
97    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
98    _8_coordSampled = _7_coord;
99    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].z;
100    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
101    _8_coordSampled = _7_coord;
102    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].w;
103    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
104    _8_coordSampled = _7_coord;
105    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].x;
106    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
107    _8_coordSampled = _7_coord;
108    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].y;
109    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
110    _8_coordSampled = _7_coord;
111    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].z;
112    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
113    _8_coordSampled = _7_coord;
114    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].w;
115    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
116    _8_coordSampled = _7_coord;
117    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].x;
118    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
119    _8_coordSampled = _7_coord;
120    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].y;
121    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
122    _8_coordSampled = _7_coord;
123    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].z;
124    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
125    _8_coordSampled = _7_coord;
126    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].w;
127    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
128    _8_coordSampled = _7_coord;
129    _6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[6].x;
130    _7_coord += _globals._anonInterface0->uIncrement_Stage1_c0;
131    _6_output *= outputColor_Stage0;
132    output_Stage1 = _6_output;
133    {
134        _out.sk_FragColor = output_Stage1 * outputCoverage_Stage0;
135    }
136    return _out;
137}
138