blob: ab2f7365127a1191e8a8dcf0eba3041a09b6f1d9 [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
struct Mat4x3_ {
/* 0x0000 */ float4 mx;
/* 0x0010 */ float4 my;
/* 0x0020 */ float4 mz;
};
struct Mat4x4_ {
/* 0x0000 */ float4 mx;
/* 0x0010 */ float4 my;
/* 0x0020 */ float4 mz;
/* 0x0030 */ float4 mw;
};
struct Mat4x2_ {
/* 0x0000 */ float4 mx;
/* 0x0010 */ float4 my;
};
struct ub_SceneParams {
/* 0x0000 */ Mat4x4_ u_Projection;
};
template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
const device T& operator[](size_t i) const device { return elements[i]; }
thread T& operator[](size_t i) thread { return elements[i]; }
const thread T& operator[](size_t i) const thread { return elements[i]; }
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
T elements[N];
};
struct ub_MaterialParams {
/* 0x0000 */ tint_array<Mat4x2_, 1> u_TexMtx;
/* 0x0020 */ float4 u_Misc0_;
};
struct ub_PacketParams {
/* 0x0000 */ tint_array<Mat4x3_, 32> u_PosMtx;
};
struct tint_module_vars_struct {
const constant ub_SceneParams* global;
const constant ub_MaterialParams* global1;
const constant ub_PacketParams* global2;
thread float3* a_Position1;
thread float2* a_UV1;
thread float4* a_Color1;
thread float3* a_Normal1;
thread float* a_PosMtxIdx1;
thread float4* v_Color;
thread float2* v_TexCoord;
thread float4* gl_Position;
};
struct VertexOutput {
float4 v_Color;
float2 v_TexCoord;
float4 member;
};
struct tint_symbol_outputs {
float4 VertexOutput_v_Color [[user(locn0)]];
float2 VertexOutput_v_TexCoord [[user(locn1)]];
float4 VertexOutput_member [[position]];
};
struct tint_symbol_inputs {
float3 a_Position [[attribute(0)]];
float2 a_UV [[attribute(1)]];
float4 a_Color [[attribute(2)]];
float3 a_Normal [[attribute(3)]];
float a_PosMtxIdx [[attribute(4)]];
};
float3 Mat4x3GetCol0_(Mat4x3_ m) {
Mat4x3_ m1 = {};
m1 = m;
Mat4x3_ const x_e2 = m1;
Mat4x3_ const x_e5 = m1;
Mat4x3_ const x_e8 = m1;
return float3(x_e2.mx[0u], x_e5.my[0u], x_e8.mz[0u]);
}
float3 Mat4x3GetCol1_(Mat4x3_ m2) {
Mat4x3_ m3 = {};
m3 = m2;
Mat4x3_ const x_e2 = m3;
Mat4x3_ const x_e5 = m3;
Mat4x3_ const x_e8 = m3;
return float3(x_e2.mx[1u], x_e5.my[1u], x_e8.mz[1u]);
}
float3 Mat4x3GetCol2_(Mat4x3_ m4) {
Mat4x3_ m5 = {};
m5 = m4;
Mat4x3_ const x_e2 = m5;
Mat4x3_ const x_e5 = m5;
Mat4x3_ const x_e8 = m5;
return float3(x_e2.mx[2u], x_e5.my[2u], x_e8.mz[2u]);
}
float3 Mat4x3GetCol3_(Mat4x3_ m6) {
Mat4x3_ m7 = {};
m7 = m6;
Mat4x3_ const x_e2 = m7;
Mat4x3_ const x_e5 = m7;
Mat4x3_ const x_e8 = m7;
return float3(x_e2.mx[3u], x_e5.my[3u], x_e8.mz[3u]);
}
float4 Mul(Mat4x4_ m8, float4 v) {
Mat4x4_ m9 = {};
float4 v1 = 0.0f;
m9 = m8;
v1 = v;
Mat4x4_ const x_e4 = m9;
float4 const x_e6 = v1;
Mat4x4_ const x_e8 = m9;
float4 const x_e10 = v1;
Mat4x4_ const x_e12 = m9;
float4 const x_e14 = v1;
Mat4x4_ const x_e16 = m9;
float4 const x_e18 = v1;
float const v_1 = dot(x_e4.mx, x_e6);
float const v_2 = dot(x_e8.my, x_e10);
float const v_3 = dot(x_e12.mz, x_e14);
return float4(v_1, v_2, v_3, dot(x_e16.mw, x_e18));
}
float3 Mul1(Mat4x3_ m10, float4 v2) {
Mat4x3_ m11 = {};
float4 v3 = 0.0f;
m11 = m10;
v3 = v2;
Mat4x3_ const x_e4 = m11;
float4 const x_e6 = v3;
Mat4x3_ const x_e8 = m11;
float4 const x_e10 = v3;
Mat4x3_ const x_e12 = m11;
float4 const x_e14 = v3;
float const v_4 = dot(x_e4.mx, x_e6);
float const v_5 = dot(x_e8.my, x_e10);
return float3(v_4, v_5, dot(x_e12.mz, x_e14));
}
float2 Mul2(Mat4x2_ m12, float4 v4) {
Mat4x2_ m13 = {};
float4 v5 = 0.0f;
m13 = m12;
v5 = v4;
Mat4x2_ const x_e4 = m13;
float4 const x_e6 = v5;
Mat4x2_ const x_e8 = m13;
float4 const x_e10 = v5;
float const v_6 = dot(x_e4.mx, x_e6);
return float2(v_6, dot(x_e8.my, x_e10));
}
float4 Mul3(float3 v6, Mat4x3_ m14) {
float3 v7 = 0.0f;
Mat4x3_ m15 = {};
v7 = v6;
m15 = m14;
Mat4x3_ const x_e5 = m15;
float3 const x_e6 = Mat4x3GetCol0_(x_e5);
float3 const x_e7 = v7;
Mat4x3_ const x_e10 = m15;
float3 const x_e11 = Mat4x3GetCol1_(x_e10);
float3 const x_e12 = v7;
Mat4x3_ const x_e15 = m15;
float3 const x_e16 = Mat4x3GetCol2_(x_e15);
float3 const x_e17 = v7;
Mat4x3_ const x_e20 = m15;
float3 const x_e21 = Mat4x3GetCol3_(x_e20);
float3 const x_e22 = v7;
float const v_7 = dot(x_e6, x_e7);
float const v_8 = dot(x_e11, x_e12);
float const v_9 = dot(x_e16, x_e17);
return float4(v_7, v_8, v_9, dot(x_e21, x_e22));
}
Mat4x4_ x_Mat4x4_(float n) {
float n1 = 0.0f;
Mat4x4_ o = {};
n1 = n;
float const x_e4 = n1;
o.mx = float4(x_e4, 0.0f, 0.0f, 0.0f);
float const x_e11 = n1;
o.my = float4(0.0f, x_e11, 0.0f, 0.0f);
float const x_e18 = n1;
o.mz = float4(0.0f, 0.0f, x_e18, 0.0f);
float const x_e25 = n1;
o.mw = float4(0.0f, 0.0f, 0.0f, x_e25);
Mat4x4_ const x_e27 = o;
return x_e27;
}
Mat4x4_ x_Mat4x4_1(Mat4x3_ m16) {
Mat4x3_ m17 = {};
Mat4x4_ o1 = {};
m17 = m16;
Mat4x4_ const x_e4 = x_Mat4x4_(1.0f);
o1 = x_e4;
Mat4x3_ const x_e7 = m17;
o1.mx = x_e7.mx;
Mat4x3_ const x_e10 = m17;
o1.my = x_e10.my;
Mat4x3_ const x_e13 = m17;
o1.mz = x_e13.mz;
Mat4x4_ const x_e15 = o1;
return x_e15;
}
Mat4x4_ x_Mat4x4_2(Mat4x2_ m18) {
Mat4x2_ m19 = {};
Mat4x4_ o2 = {};
m19 = m18;
Mat4x4_ const x_e4 = x_Mat4x4_(1.0f);
o2 = x_e4;
Mat4x2_ const x_e7 = m19;
o2.mx = x_e7.mx;
Mat4x2_ const x_e10 = m19;
o2.my = x_e10.my;
Mat4x4_ const x_e12 = o2;
return x_e12;
}
Mat4x3_ x_Mat4x3_(float n2) {
float n3 = 0.0f;
Mat4x3_ o3 = {};
n3 = n2;
float const x_e4 = n3;
o3.mx = float4(x_e4, 0.0f, 0.0f, 0.0f);
float const x_e11 = n3;
o3.my = float4(0.0f, x_e11, 0.0f, 0.0f);
float const x_e18 = n3;
o3.mz = float4(0.0f, 0.0f, x_e18, 0.0f);
Mat4x3_ const x_e21 = o3;
return x_e21;
}
Mat4x3_ x_Mat4x3_1(Mat4x4_ m20) {
Mat4x4_ m21 = {};
Mat4x3_ o4 = {};
m21 = m20;
Mat4x4_ const x_e4 = m21;
o4.mx = x_e4.mx;
Mat4x4_ const x_e7 = m21;
o4.my = x_e7.my;
Mat4x4_ const x_e10 = m21;
o4.mz = x_e10.mz;
Mat4x3_ const x_e12 = o4;
return x_e12;
}
int tint_f32_to_i32(float value) {
return select(2147483647, select((-2147483647 - 1), int(value), (value >= -2147483648.0f)), (value <= 2147483520.0f));
}
void main1(tint_module_vars_struct tint_module_vars) {
Mat4x3_ t_PosMtx = {};
float2 t_TexSpaceCoord = 0.0f;
float const x_e15 = (*tint_module_vars.a_PosMtxIdx1);
Mat4x3_ const x_e18 = (*tint_module_vars.global2).u_PosMtx[tint_f32_to_i32(x_e15)];
t_PosMtx = x_e18;
Mat4x3_ const x_e23 = t_PosMtx;
Mat4x4_ const x_e24 = x_Mat4x4_1(x_e23);
float3 const x_e25 = (*tint_module_vars.a_Position1);
Mat4x3_ const x_e29 = t_PosMtx;
Mat4x4_ const x_e30 = x_Mat4x4_1(x_e29);
float3 const x_e31 = (*tint_module_vars.a_Position1);
float4 const x_e34 = Mul(x_e30, float4(x_e31, 1.0f));
Mat4x4_ const x_e35 = (*tint_module_vars.global).u_Projection;
Mat4x3_ const x_e37 = t_PosMtx;
Mat4x4_ const x_e38 = x_Mat4x4_1(x_e37);
float3 const x_e39 = (*tint_module_vars.a_Position1);
Mat4x3_ const x_e43 = t_PosMtx;
Mat4x4_ const x_e44 = x_Mat4x4_1(x_e43);
float3 const x_e45 = (*tint_module_vars.a_Position1);
float4 const x_e48 = Mul(x_e44, float4(x_e45, 1.0f));
float4 const x_e49 = Mul(x_e35, x_e48);
(*tint_module_vars.gl_Position) = x_e49;
float4 const x_e50 = (*tint_module_vars.a_Color1);
(*tint_module_vars.v_Color) = x_e50;
float4 const x_e52 = (*tint_module_vars.global1).u_Misc0_;
if ((x_e52[0u] == 2.0f)) {
float3 const x_e59 = (*tint_module_vars.a_Normal1);
Mat4x2_ const x_e64 = (*tint_module_vars.global1).u_TexMtx[0];
float3 const x_e65 = (*tint_module_vars.a_Normal1);
float2 const x_e68 = Mul2(x_e64, float4(x_e65, 1.0f));
(*tint_module_vars.v_TexCoord) = x_e68.xy;
return;
} else {
float2 const x_e73 = (*tint_module_vars.a_UV1);
Mat4x2_ const x_e79 = (*tint_module_vars.global1).u_TexMtx[0];
float2 const x_e80 = (*tint_module_vars.a_UV1);
float2 const x_e84 = Mul2(x_e79, float4(x_e80, 1.0f, 1.0f));
(*tint_module_vars.v_TexCoord) = x_e84.xy;
return;
}
/* unreachable */
}
VertexOutput tint_symbol_inner(float3 a_Position, float2 a_UV, float4 a_Color, float3 a_Normal, float a_PosMtxIdx, tint_module_vars_struct tint_module_vars) {
(*tint_module_vars.a_Position1) = a_Position;
(*tint_module_vars.a_UV1) = a_UV;
(*tint_module_vars.a_Color1) = a_Color;
(*tint_module_vars.a_Normal1) = a_Normal;
(*tint_module_vars.a_PosMtxIdx1) = a_PosMtxIdx;
main1(tint_module_vars);
float4 const x_e11 = (*tint_module_vars.v_Color);
float2 const x_e13 = (*tint_module_vars.v_TexCoord);
float4 const x_e15 = (*tint_module_vars.gl_Position);
return VertexOutput{.v_Color=x_e11, .v_TexCoord=x_e13, .member=x_e15};
}
vertex tint_symbol_outputs tint_symbol(tint_symbol_inputs inputs [[stage_in]], const constant ub_SceneParams* global [[buffer(1)]], const constant ub_MaterialParams* global1 [[buffer(2)]], const constant ub_PacketParams* global2 [[buffer(0)]]) {
thread float3 a_Position1 = 0.0f;
thread float2 a_UV1 = 0.0f;
thread float4 a_Color1 = 0.0f;
thread float3 a_Normal1 = 0.0f;
thread float a_PosMtxIdx1 = 0.0f;
thread float4 v_Color = 0.0f;
thread float2 v_TexCoord = 0.0f;
thread float4 gl_Position = 0.0f;
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.global=global, .global1=global1, .global2=global2, .a_Position1=(&a_Position1), .a_UV1=(&a_UV1), .a_Color1=(&a_Color1), .a_Normal1=(&a_Normal1), .a_PosMtxIdx1=(&a_PosMtxIdx1), .v_Color=(&v_Color), .v_TexCoord=(&v_TexCoord), .gl_Position=(&gl_Position)};
VertexOutput const v_10 = tint_symbol_inner(inputs.a_Position, inputs.a_UV, inputs.a_Color, inputs.a_Normal, inputs.a_PosMtxIdx, tint_module_vars);
tint_symbol_outputs tint_wrapper_result = {};
tint_wrapper_result.VertexOutput_v_Color = v_10.v_Color;
tint_wrapper_result.VertexOutput_v_TexCoord = v_10.v_TexCoord;
tint_wrapper_result.VertexOutput_member = v_10.member;
return tint_wrapper_result;
}