| #include <metal_stdlib> |
| |
| using namespace metal; |
| struct buf0 { |
| /* 0x0000 */ packed_float2 resolution; |
| }; |
| struct tint_array_wrapper { |
| float4 arr[8]; |
| }; |
| struct tint_array_wrapper_1 { |
| float4 arr[16]; |
| }; |
| struct main_out { |
| float4 x_GLF_color_1; |
| }; |
| struct tint_symbol_1 { |
| float4 x_GLF_color_1 [[color(0)]]; |
| }; |
| |
| bool collision_vf2_vf4_(thread float2* const pos, thread float4* const quad) { |
| float const x_110 = (*(pos)).x; |
| float const x_112 = (*(quad)).x; |
| if ((x_110 < x_112)) { |
| return false; |
| } |
| float const x_117 = (*(pos)).y; |
| float const x_119 = (*(quad)).y; |
| if ((x_117 < x_119)) { |
| return false; |
| } |
| float const x_124 = (*(pos)).x; |
| float const x_126 = (*(quad)).x; |
| float const x_128 = (*(quad)).z; |
| if ((x_124 > (x_126 + x_128))) { |
| return false; |
| } |
| float const x_134 = (*(pos)).y; |
| float const x_136 = (*(quad)).y; |
| float const x_138 = (*(quad)).w; |
| if ((x_134 > (x_136 + x_138))) { |
| return false; |
| } |
| return true; |
| } |
| |
| float4 match_vf2_(thread float2* const pos_1, thread float4* const tint_symbol_7) { |
| float4 res = 0.0f; |
| float x_144 = 0.0f; |
| float x_145 = 0.0f; |
| int i = 0; |
| float2 param = 0.0f; |
| float4 param_1 = 0.0f; |
| tint_array_wrapper indexable = {}; |
| tint_array_wrapper indexable_1 = {}; |
| tint_array_wrapper indexable_2 = {}; |
| tint_array_wrapper_1 indexable_3 = {}; |
| float const x_147 = (*(tint_symbol_7)).x; |
| if ((x_147 < 0.0f)) { |
| x_144 = -1.0f; |
| } else { |
| float const x_153 = (*(tint_symbol_7)).x; |
| if ((x_153 >= 0.0f)) { |
| float const x_159 = (*(tint_symbol_7)).x; |
| x_145 = select(1.0f, 0.5f, (x_159 >= 0.0f)); |
| } else { |
| x_145 = 1.0f; |
| } |
| float const x_162 = x_145; |
| x_144 = fmin(x_162, 0.5f); |
| } |
| float const x_164 = x_144; |
| res = float4(clamp(0.5f, 0.5f, x_164), 0.5f, 1.0f, 1.0f); |
| i = 0; |
| while (true) { |
| int const x_171 = i; |
| if ((x_171 < 8)) { |
| } else { |
| break; |
| } |
| int const x_174 = i; |
| float2 const x_175 = *(pos_1); |
| param = x_175; |
| tint_array_wrapper const tint_symbol_2 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; |
| indexable = tint_symbol_2; |
| float4 const x_177 = indexable.arr[x_174]; |
| param_1 = x_177; |
| bool const x_178 = collision_vf2_vf4_(&(param), &(param_1)); |
| if (x_178) { |
| int const x_181 = i; |
| tint_array_wrapper const tint_symbol_3 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; |
| indexable_1 = tint_symbol_3; |
| float const x_183 = indexable_1.arr[x_181].x; |
| int const x_185 = i; |
| tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; |
| indexable_2 = tint_symbol_4; |
| float const x_187 = indexable_2.arr[x_185].y; |
| int const x_190 = i; |
| tint_array_wrapper_1 const tint_symbol_5 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; |
| indexable_3 = tint_symbol_5; |
| float4 const x_196 = indexable_3.arr[(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(int(x_183)) * as_type<uint>(int(x_187))))) + as_type<uint>(as_type<int>((as_type<uint>(x_190) * as_type<uint>(9))))))) + as_type<uint>(11))) % 16)]; |
| res = x_196; |
| } |
| { |
| int const x_197 = i; |
| i = as_type<int>((as_type<uint>(x_197) + as_type<uint>(1))); |
| } |
| } |
| float4 const x_199 = res; |
| return x_199; |
| } |
| |
| void main_1(constant buf0& x_20, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { |
| float2 lin = 0.0f; |
| float2 param_2 = 0.0f; |
| float4 const x_98 = *(tint_symbol_8); |
| float2 const x_101 = x_20.resolution; |
| lin = (float2(x_98.x, x_98.y) / x_101); |
| float2 const x_103 = lin; |
| lin = floor((x_103 * 32.0f)); |
| float2 const x_106 = lin; |
| param_2 = x_106; |
| float4 const x_107 = match_vf2_(&(param_2), tint_symbol_8); |
| *(tint_symbol_9) = x_107; |
| return; |
| } |
| |
| main_out tint_symbol_inner(constant buf0& x_20, float4 gl_FragCoord_param, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { |
| *(tint_symbol_10) = gl_FragCoord_param; |
| main_1(x_20, tint_symbol_10, tint_symbol_11); |
| main_out const tint_symbol_6 = {.x_GLF_color_1=*(tint_symbol_11)}; |
| return tint_symbol_6; |
| } |
| |
| fragment tint_symbol_1 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_20 [[buffer(0)]]) { |
| thread float4 tint_symbol_12 = 0.0f; |
| thread float4 tint_symbol_13 = 0.0f; |
| main_out const inner_result = tint_symbol_inner(x_20, gl_FragCoord_param, &(tint_symbol_12), &(tint_symbol_13)); |
| tint_symbol_1 wrapper_result = {}; |
| wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; |
| return wrapper_result; |
| } |
| |