blob: c8cbf19939b0237aecc0dc5b82ba5033ac3282da [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_2 {
float4 x_GLF_color_1 [[color(0)]];
};
float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) {
float const x_79 = (*(a)).x;
float const x_81 = (*(b)).y;
float const x_84 = (*(b)).x;
float const x_86 = (*(a)).y;
return ((x_79 * x_81) - (x_84 * x_86));
}
int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) {
bool x_90 = false;
int x_91 = 0;
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_140 = false;
bool x_168 = false;
bool x_141_phi = false;
bool x_169_phi = false;
int x_173_phi = 0;
switch(0u) {
default: {
float const x_95 = (*(p)).x;
float const x_97 = (*(a_1)).x;
float const x_100 = (*(p)).y;
float const x_102 = (*(a_1)).y;
float const x_106 = (*(b_1)).x;
float const x_107 = (*(a_1)).x;
float const x_110 = (*(b_1)).y;
float const x_111 = (*(a_1)).y;
param = float2((x_95 - x_97), (x_100 - x_102));
param_1 = float2((x_106 - x_107), (x_110 - x_111));
float const x_114 = cross2d_vf2_vf2_(&(param), &(param_1));
pab = x_114;
float const x_115 = (*(p)).x;
float const x_116 = (*(b_1)).x;
float const x_118 = (*(p)).y;
float const x_119 = (*(b_1)).y;
float const x_123 = (*(c)).x;
float const x_124 = (*(b_1)).x;
float const x_127 = (*(c)).y;
float const x_128 = (*(b_1)).y;
param_2 = float2((x_115 - x_116), (x_118 - x_119));
param_3 = float2((x_123 - x_124), (x_127 - x_128));
float const x_131 = cross2d_vf2_vf2_(&(param_2), &(param_3));
pbc = x_131;
bool const x_134 = ((x_114 < 0.0f) && (x_131 < 0.0f));
x_141_phi = x_134;
if (!(x_134)) {
x_140 = ((x_114 >= 0.0f) && (x_131 >= 0.0f));
x_141_phi = x_140;
}
bool const x_141 = x_141_phi;
if (!(x_141)) {
x_90 = true;
x_91 = 0;
x_173_phi = 0;
break;
}
float const x_145 = (*(p)).x;
float const x_146 = (*(c)).x;
float const x_148 = (*(p)).y;
float const x_149 = (*(c)).y;
float const x_152 = (*(a_1)).x;
float const x_153 = (*(c)).x;
float const x_155 = (*(a_1)).y;
float const x_156 = (*(c)).y;
param_4 = float2((x_145 - x_146), (x_148 - x_149));
param_5 = float2((x_152 - x_153), (x_155 - x_156));
float const x_159 = cross2d_vf2_vf2_(&(param_4), &(param_5));
pca = x_159;
bool const x_162 = ((x_114 < 0.0f) && (x_159 < 0.0f));
x_169_phi = x_162;
if (!(x_162)) {
x_168 = ((x_114 >= 0.0f) && (x_159 >= 0.0f));
x_169_phi = x_168;
}
bool const x_169 = x_169_phi;
if (!(x_169)) {
x_90 = true;
x_91 = 0;
x_173_phi = 0;
break;
}
x_90 = true;
x_91 = 1;
x_173_phi = 1;
break;
}
}
int const x_173 = x_173_phi;
return x_173;
}
void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) {
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_67 = *(tint_symbol_5);
float2 const x_70 = x_24.resolution;
float2 const x_71 = (float2(x_67.x, x_67.y) / x_70);
pos = x_71;
param_6 = x_71;
param_7 = float2(0.699999988f, 0.300000012f);
param_8 = float2(0.5f, 0.899999976f);
param_9 = float2(0.100000001f, 0.400000006f);
int const x_72 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
if ((x_72 == 1)) {
*(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
fragment tint_symbol_2 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;
tint_symbol_7 = gl_FragCoord_param;
main_1(x_24, &(tint_symbol_7), &(tint_symbol_8));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}