blob: 1c1d52740fe9e38e0a133ce91d6324de2e629a59 [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 resolution;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) {
float const x_76 = (*(a)).x;
float const x_78 = (*(b)).y;
float const x_81 = (*(b)).x;
float const x_83 = (*(a)).y;
return ((x_76 * x_78) - (x_81 * x_83));
}
int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) {
float pab = 0.0f;
float2 param = 0.0f;
float2 param_1 = 0.0f;
float pbc = 0.0f;
float2 param_2 = 0.0f;
float2 param_3 = 0.0f;
float pca = 0.0f;
float2 param_4 = 0.0f;
float2 param_5 = 0.0f;
bool x_145 = false;
bool x_185 = false;
bool x_146_phi = false;
bool x_186_phi = false;
float const x_88 = (*(p)).x;
float const x_90 = (*(a_1)).x;
float const x_93 = (*(p)).y;
float const x_95 = (*(a_1)).y;
float const x_99 = (*(b_1)).x;
float const x_101 = (*(a_1)).x;
float const x_104 = (*(b_1)).y;
float const x_106 = (*(a_1)).y;
param = float2((x_88 - x_90), (x_93 - x_95));
param_1 = float2((x_99 - x_101), (x_104 - x_106));
float const x_109 = cross2d_vf2_vf2_(&(param), &(param_1));
pab = x_109;
float const x_111 = (*(p)).x;
float const x_113 = (*(b_1)).x;
float const x_116 = (*(p)).y;
float const x_118 = (*(b_1)).y;
float const x_122 = (*(c)).x;
float const x_124 = (*(b_1)).x;
float const x_127 = (*(c)).y;
float const x_129 = (*(b_1)).y;
param_2 = float2((x_111 - x_113), (x_116 - x_118));
param_3 = float2((x_122 - x_124), (x_127 - x_129));
float const x_132 = cross2d_vf2_vf2_(&(param_2), &(param_3));
pbc = x_132;
float const x_133 = pab;
float const x_135 = pbc;
bool const x_137 = ((x_133 < 0.0f) && (x_135 < 0.0f));
x_146_phi = x_137;
if (!(x_137)) {
float const x_141 = pab;
float const x_143 = pbc;
x_145 = ((x_141 >= 0.0f) && (x_143 >= 0.0f));
x_146_phi = x_145;
}
bool const x_146 = x_146_phi;
if (!(x_146)) {
return 0;
}
float const x_151 = (*(p)).x;
float const x_153 = (*(c)).x;
float const x_156 = (*(p)).y;
float const x_158 = (*(c)).y;
float const x_162 = (*(a_1)).x;
float const x_164 = (*(c)).x;
float const x_167 = (*(a_1)).y;
float const x_169 = (*(c)).y;
param_4 = float2((x_151 - x_153), (x_156 - x_158));
param_5 = float2((x_162 - x_164), (x_167 - x_169));
float const x_172 = cross2d_vf2_vf2_(&(param_4), &(param_5));
pca = x_172;
float const x_173 = pab;
float const x_175 = pca;
bool const x_177 = ((x_173 < 0.0f) && (x_175 < 0.0f));
x_186_phi = x_177;
if (!(x_177)) {
float const x_181 = pab;
float const x_183 = pca;
x_185 = ((x_181 >= 0.0f) && (x_183 >= 0.0f));
x_186_phi = x_185;
}
bool const x_186 = x_186_phi;
if (!(x_186)) {
return 0;
}
return 1;
}
void main_1(constant buf0& x_24, thread float4* const tint_symbol_3, thread float4* const tint_symbol_4) {
float2 pos = 0.0f;
float2 param_6 = 0.0f;
float2 param_7 = 0.0f;
float2 param_8 = 0.0f;
float2 param_9 = 0.0f;
float4 const x_63 = *(tint_symbol_3);
float2 const x_66 = x_24.resolution;
pos = (float2(x_63.x, x_63.y) / x_66);
float2 const x_68 = pos;
param_6 = x_68;
param_7 = float2(0.699999988f, 0.300000012f);
param_8 = float2(0.5f, 0.899999976f);
param_9 = float2(0.100000001f, 0.400000006f);
int const x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
if ((x_69 == 1)) {
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
main_out tint_symbol_inner(constant buf0& x_24, float4 gl_FragCoord_param, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) {
*(tint_symbol_5) = gl_FragCoord_param;
main_1(x_24, tint_symbol_5, tint_symbol_6);
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_6)};
return tint_symbol_2;
}
fragment tint_symbol_1 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) {
thread float4 tint_symbol_7 = 0.0f;
thread float4 tint_symbol_8 = 0.0f;
main_out const inner_result = tint_symbol_inner(x_24, gl_FragCoord_param, &(tint_symbol_7), &(tint_symbol_8));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}