blob: 6f56a9ce3e907e7042691b522c3ab974283e1c4c [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
template<typename T, int N, int M>
inline vec<T, M> operator*(matrix<T, N, M> lhs, packed_vec<T, N> rhs) {
return lhs * vec<T, N>(rhs);
}
template<typename T, int N, int M>
inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
return vec<T, M>(lhs) * rhs;
}
struct Scene {
/* 0x0000 */ float4 vEyePosition;
};
struct Material {
/* 0x0000 */ float4 vDiffuseColor;
/* 0x0010 */ packed_float3 vAmbientColor;
/* 0x001c */ float dummy;
/* 0x0020 */ packed_float3 vEmissiveColor;
/* 0x002c */ float dummy2;
};
struct Mesh {
/* 0x0000 */ float visibility;
};
void main_1(thread float* const tint_symbol_5, thread float* const tint_symbol_6, const constant Scene* const tint_symbol_7, const constant Material* const tint_symbol_8, const constant Mesh* const tint_symbol_9, thread float4* const tint_symbol_10) {
float3 viewDirectionW = 0.0f;
float4 baseColor = 0.0f;
float3 diffuseColor = 0.0f;
float alpha = 0.0f;
float3 normalW = 0.0f;
float2 uvOffset = 0.0f;
float3 baseAmbientColor = 0.0f;
float glossiness = 0.0f;
float3 diffuseBase = 0.0f;
float shadow = 0.0f;
float4 refractionColor = 0.0f;
float4 reflectionColor = 0.0f;
float3 emissiveColor = 0.0f;
float3 finalDiffuse = 0.0f;
float3 finalSpecular = 0.0f;
float4 color = 0.0f;
float const x_9 = *(tint_symbol_5);
if ((x_9 > 0.0f)) {
discard_fragment();
}
float const x_17 = *(tint_symbol_6);
if ((x_17 > 0.0f)) {
discard_fragment();
}
float4 const x_34 = (*(tint_symbol_7)).vEyePosition;
float3 const x_38 = float3(0.0f, 0.0f, 0.0f);
viewDirectionW = normalize((float3(x_34[0], x_34[1], x_34[2]) - x_38));
baseColor = float4(1.0f, 1.0f, 1.0f, 1.0f);
float4 const x_52 = (*(tint_symbol_8)).vDiffuseColor;
diffuseColor = float3(x_52[0], x_52[1], x_52[2]);
float const x_60 = (*(tint_symbol_8)).vDiffuseColor[3];
alpha = x_60;
float3 const x_62 = float3(0.0f, 0.0f, 0.0f);
float3 const x_64 = float3(0.0f, 0.0f, 0.0f);
normalW = normalize(-(cross(dfdx(x_62), dfdy(x_64))));
uvOffset = float2(0.0f, 0.0f);
float4 const x_74 = float4(0.0f, 0.0f, 0.0f, 0.0f);
float4 const x_76 = baseColor;
float3 const x_78 = (float3(x_76[0], x_76[1], x_76[2]) * float3(x_74[0], x_74[1], x_74[2]));
float4 const x_79 = baseColor;
baseColor = float4(x_78[0], x_78[1], x_78[2], x_79[3]);
baseAmbientColor = float3(1.0f, 1.0f, 1.0f);
glossiness = 0.0f;
diffuseBase = float3(0.0f, 0.0f, 0.0f);
shadow = 1.0f;
refractionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
reflectionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
float3 const x_94 = (*(tint_symbol_8)).vEmissiveColor;
emissiveColor = x_94;
float3 const x_96 = diffuseBase;
float3 const x_97 = diffuseColor;
float3 const x_99 = emissiveColor;
float3 const x_103 = (*(tint_symbol_8)).vAmbientColor;
float4 const x_108 = baseColor;
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), float3(0.0f, 0.0f, 0.0f), float3(1.0f, 1.0f, 1.0f)) * float3(x_108[0], x_108[1], x_108[2]));
finalSpecular = float3(0.0f, 0.0f, 0.0f);
float3 const x_113 = finalDiffuse;
float3 const x_114 = baseAmbientColor;
float3 const x_116 = finalSpecular;
float4 const x_118 = reflectionColor;
float4 const x_121 = refractionColor;
float3 const x_123 = ((((x_113 * x_114) + x_116) + float3(x_118[0], x_118[1], x_118[2])) + float3(x_121[0], x_121[1], x_121[2]));
float const x_124 = alpha;
color = float4(x_123[0], x_123[1], x_123[2], x_124);
float4 const x_129 = color;
float3 const x_132 = fmax(float3(x_129[0], x_129[1], x_129[2]), float3(0.0f, 0.0f, 0.0f));
float4 const x_133 = color;
color = float4(x_132[0], x_132[1], x_132[2], x_133[3]);
float const x_140 = (*(tint_symbol_9)).visibility;
float const x_142 = color[3];
color[3] = (x_142 * x_140);
float4 const x_147 = color;
*(tint_symbol_10) = x_147;
return;
}
struct main_out {
float4 glFragColor_1;
};
struct tint_symbol_2 {
float fClipDistance3_param [[user(locn2)]];
float fClipDistance4_param [[user(locn3)]];
};
struct tint_symbol_3 {
float4 glFragColor_1 [[color(0)]];
};
main_out tint_symbol_inner(float fClipDistance3_param, float fClipDistance4_param, thread float* const tint_symbol_11, thread float* const tint_symbol_12, const constant Scene* const tint_symbol_13, const constant Material* const tint_symbol_14, const constant Mesh* const tint_symbol_15, thread float4* const tint_symbol_16) {
*(tint_symbol_11) = fClipDistance3_param;
*(tint_symbol_12) = fClipDistance4_param;
main_1(tint_symbol_11, tint_symbol_12, tint_symbol_13, tint_symbol_14, tint_symbol_15, tint_symbol_16);
main_out const tint_symbol_4 = {.glFragColor_1=*(tint_symbol_16)};
return tint_symbol_4;
}
fragment tint_symbol_3 tint_symbol(const constant Scene* tint_symbol_19 [[buffer(0)]], const constant Material* tint_symbol_20 [[buffer(1)]], const constant Mesh* tint_symbol_21 [[buffer(2)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float tint_symbol_17 = 0.0f;
thread float tint_symbol_18 = 0.0f;
thread float4 tint_symbol_22 = 0.0f;
main_out const inner_result = tint_symbol_inner(tint_symbol_1.fClipDistance3_param, tint_symbol_1.fClipDistance4_param, &(tint_symbol_17), &(tint_symbol_18), tint_symbol_19, tint_symbol_20, tint_symbol_21, &(tint_symbol_22));
tint_symbol_3 wrapper_result = {};
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
return wrapper_result;
}