blob: 40e2a56bc8aad8337d7bcadad98a481f17dc695a [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
struct buf1 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct buf0 {
/* 0x0000 */ packed_float2 resolution;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 [[color(0)]];
};
int pointInTriangle_vf2_vf2_vf2_vf2_(constant buf1& x_11, thread float2* const p, thread float2* const a, thread float2* const b, thread float2* const c, thread float4* const tint_symbol_5) {
float x_78 = 0.0f;
float x_79 = 0.0f;
float x_80 = 0.0f;
float2 param = 0.0f;
float2 param_1 = 0.0f;
float2 param_2 = 0.0f;
float2 param_3 = 0.0f;
float2 param_4 = 0.0f;
float2 param_5 = 0.0f;
bool x_147 = false;
bool x_203 = false;
bool x_148_phi = false;
bool x_204_phi = false;
float const x_82 = (*(p)).x;
float const x_84 = (*(a)).x;
float const x_87 = (*(p)).y;
float const x_89 = (*(a)).y;
float const x_93 = (*(b)).x;
float const x_94 = (*(a)).x;
float const x_97 = (*(b)).y;
float const x_98 = (*(a)).y;
param = float2((x_82 - x_84), (x_87 - x_89));
param_1 = float2((x_93 - x_94), (x_97 - x_98));
float const x_102 = param.x;
float const x_104 = param_1.y;
float const x_107 = param_1.x;
float const x_109 = param.y;
float const x_111 = ((x_102 * x_104) - (x_107 * x_109));
x_80 = x_111;
float const x_112 = (*(p)).x;
float const x_113 = (*(b)).x;
float const x_115 = (*(p)).y;
float const x_116 = (*(b)).y;
float const x_120 = (*(c)).x;
float const x_121 = (*(b)).x;
float const x_124 = (*(c)).y;
float const x_125 = (*(b)).y;
param_2 = float2((x_112 - x_113), (x_115 - x_116));
param_3 = float2((x_120 - x_121), (x_124 - x_125));
float const x_129 = param_2.x;
float const x_131 = param_3.y;
float const x_134 = param_3.x;
float const x_136 = param_2.y;
float const x_138 = ((x_129 * x_131) - (x_134 * x_136));
x_79 = x_138;
bool const x_139 = (x_111 < 0.0f);
bool const x_141 = (x_139 & (x_138 < 0.0f));
x_148_phi = x_141;
if (!(x_141)) {
x_147 = ((x_111 >= 0.0f) & (x_138 >= 0.0f));
x_148_phi = x_147;
}
int x_153_phi = 0;
bool const x_148 = x_148_phi;
if (!(x_148)) {
x_153_phi = 0;
while (true) {
int x_154 = 0;
int x_164_phi = 0;
int const x_153 = x_153_phi;
float const x_159 = x_11.injectionSwitch.y;
int const x_160 = int(x_159);
if ((x_153 < x_160)) {
} else {
break;
}
*(tint_symbol_5) = float4(1.0f, 1.0f, 1.0f, 1.0f);
x_164_phi = 0;
while (true) {
int x_165 = 0;
int const x_164 = x_164_phi;
if ((x_164 < x_160)) {
} else {
break;
}
*(tint_symbol_5) = float4(1.0f, 1.0f, 1.0f, 1.0f);
{
x_165 = as_type<int>((as_type<uint>(x_164) + as_type<uint>(1)));
x_164_phi = x_165;
}
}
{
x_154 = as_type<int>((as_type<uint>(x_153) + as_type<uint>(1)));
x_153_phi = x_154;
}
}
return 0;
}
float const x_171 = (*(p)).x;
float const x_172 = (*(c)).x;
float const x_174 = (*(p)).y;
float const x_175 = (*(c)).y;
float const x_178 = (*(a)).x;
float const x_179 = (*(c)).x;
float const x_181 = (*(a)).y;
float const x_182 = (*(c)).y;
param_4 = float2((x_171 - x_172), (x_174 - x_175));
param_5 = float2((x_178 - x_179), (x_181 - x_182));
float const x_186 = param_4.x;
float const x_188 = param_5.y;
float const x_191 = param_5.x;
float const x_193 = param_4.y;
float const x_195 = ((x_186 * x_188) - (x_191 * x_193));
x_78 = x_195;
bool const x_197 = (x_139 & (x_195 < 0.0f));
x_204_phi = x_197;
if (!(x_197)) {
x_203 = ((x_111 >= 0.0f) & (x_195 >= 0.0f));
x_204_phi = x_203;
}
bool const x_204 = x_204_phi;
if (!(x_204)) {
return 0;
}
return 1;
}
void main_1(constant buf0& x_19, constant buf1& x_11, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
float2 param_6 = 0.0f;
float2 param_7 = 0.0f;
float2 param_8 = 0.0f;
float2 param_9 = 0.0f;
float4 const x_60 = *(tint_symbol_6);
float2 const x_63 = x_19.resolution;
param_6 = (float2(x_60.x, x_60.y) / x_63);
param_7 = float2(0.699999988f, 0.300000012f);
param_8 = float2(0.5f, 0.899999976f);
param_9 = float2(0.100000001f, 0.400000006f);
int const x_65 = pointInTriangle_vf2_vf2_vf2_vf2_(x_11, &(param_6), &(param_7), &(param_8), &(param_9), tint_symbol_7);
if ((x_65 == 1)) {
float const x_71 = x_11.injectionSwitch.y;
float const x_73 = x_11.injectionSwitch.x;
if ((x_71 >= x_73)) {
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
}
} else {
*(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_19 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
tint_symbol_8 = gl_FragCoord_param;
main_1(x_19, x_11, &(tint_symbol_8), &(tint_symbol_9));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}