dawn-cmake/test/tint/bug/tint/922.wgsl.expected.msl

313 lines
9.4 KiB
Plaintext

#include <metal_stdlib>
using namespace metal;
struct Mat4x4_ {
/* 0x0000 */ float4 mx;
/* 0x0010 */ float4 my;
/* 0x0020 */ float4 mz;
/* 0x0030 */ float4 mw;
};
struct Mat4x3_ {
/* 0x0000 */ float4 mx;
/* 0x0010 */ float4 my;
/* 0x0020 */ float4 mz;
};
struct Mat4x2_ {
/* 0x0000 */ float4 mx;
/* 0x0010 */ float4 my;
};
struct ub_SceneParams {
/* 0x0000 */ Mat4x4_ u_Projection;
};
struct tint_array_wrapper {
/* 0x0000 */ Mat4x2_ arr[1];
};
struct ub_MaterialParams {
/* 0x0000 */ tint_array_wrapper u_TexMtx;
/* 0x0020 */ float4 u_Misc0_;
};
struct tint_array_wrapper_1 {
/* 0x0000 */ Mat4x3_ arr[32];
};
struct ub_PacketParams {
/* 0x0000 */ tint_array_wrapper_1 u_PosMtx;
};
struct VertexOutput {
float4 v_Color;
float2 v_TexCoord;
float4 member;
};
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[0], x_e5.my[0], x_e8.mz[0]);
}
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[1], x_e5.my[1], x_e8.mz[1]);
}
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[2], x_e5.my[2], x_e8.mz[2]);
}
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[3], x_e5.my[3], x_e8.mz[3]);
}
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;
return float4(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10), dot(x_e12.mz, x_e14), 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;
return float3(dot(x_e4.mx, x_e6), dot(x_e8.my, x_e10), 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;
return float2(dot(x_e4.mx, x_e6), 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;
return float4(dot(x_e6, x_e7), dot(x_e11, x_e12), dot(x_e16, x_e17), 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;
}
void main1(thread float* const tint_symbol_5, const constant ub_PacketParams* const tint_symbol_6, thread float3* const tint_symbol_7, const constant ub_SceneParams* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11, const constant ub_MaterialParams* const tint_symbol_12, thread float3* const tint_symbol_13, thread float2* const tint_symbol_14, thread float2* const tint_symbol_15) {
Mat4x3_ t_PosMtx = {};
float2 t_TexSpaceCoord = 0.0f;
float const x_e15 = *(tint_symbol_5);
Mat4x3_ const x_e18 = (*(tint_symbol_6)).u_PosMtx.arr[int(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_symbol_7);
Mat4x3_ const x_e29 = t_PosMtx;
Mat4x4_ const x_e30 = x_Mat4x4_1(x_e29);
float3 const x_e31 = *(tint_symbol_7);
float4 const x_e34 = Mul(x_e30, float4(x_e31, 1.0f));
Mat4x4_ const x_e35 = (*(tint_symbol_8)).u_Projection;
Mat4x3_ const x_e37 = t_PosMtx;
Mat4x4_ const x_e38 = x_Mat4x4_1(x_e37);
float3 const x_e39 = *(tint_symbol_7);
Mat4x3_ const x_e43 = t_PosMtx;
Mat4x4_ const x_e44 = x_Mat4x4_1(x_e43);
float3 const x_e45 = *(tint_symbol_7);
float4 const x_e48 = Mul(x_e44, float4(x_e45, 1.0f));
float4 const x_e49 = Mul(x_e35, x_e48);
*(tint_symbol_9) = x_e49;
float4 const x_e50 = *(tint_symbol_10);
*(tint_symbol_11) = x_e50;
float4 const x_e52 = (*(tint_symbol_12)).u_Misc0_;
if ((x_e52[0] == 2.0f)) {
{
float3 const x_e59 = *(tint_symbol_13);
Mat4x2_ const x_e64 = (*(tint_symbol_12)).u_TexMtx.arr[0];
float3 const x_e65 = *(tint_symbol_13);
float2 const x_e68 = Mul2(x_e64, float4(x_e65, 1.0f));
*(tint_symbol_14) = float2(x_e68).xy;
return;
}
} else {
{
float2 const x_e73 = *(tint_symbol_15);
Mat4x2_ const x_e79 = (*(tint_symbol_12)).u_TexMtx.arr[0];
float2 const x_e80 = *(tint_symbol_15);
float2 const x_e84 = Mul2(x_e79, float4(x_e80, 1.0f, 1.0f));
*(tint_symbol_14) = float2(x_e84).xy;
return;
}
}
}
struct tint_symbol_2 {
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)]];
};
struct tint_symbol_3 {
float4 v_Color [[user(locn0)]];
float2 v_TexCoord [[user(locn1)]];
float4 member [[position]];
};
VertexOutput tint_symbol_inner(float3 a_Position, float2 a_UV, float4 a_Color, float3 a_Normal, float a_PosMtxIdx, thread float3* const tint_symbol_16, thread float2* const tint_symbol_17, thread float4* const tint_symbol_18, thread float3* const tint_symbol_19, thread float* const tint_symbol_20, const constant ub_PacketParams* const tint_symbol_21, const constant ub_SceneParams* const tint_symbol_22, thread float4* const tint_symbol_23, thread float4* const tint_symbol_24, const constant ub_MaterialParams* const tint_symbol_25, thread float2* const tint_symbol_26) {
*(tint_symbol_16) = a_Position;
*(tint_symbol_17) = a_UV;
*(tint_symbol_18) = a_Color;
*(tint_symbol_19) = a_Normal;
*(tint_symbol_20) = a_PosMtxIdx;
main1(tint_symbol_20, tint_symbol_21, tint_symbol_16, tint_symbol_22, tint_symbol_23, tint_symbol_18, tint_symbol_24, tint_symbol_25, tint_symbol_19, tint_symbol_26, tint_symbol_17);
float4 const x_e11 = *(tint_symbol_24);
float2 const x_e13 = *(tint_symbol_26);
float4 const x_e15 = *(tint_symbol_23);
VertexOutput const tint_symbol_4 = {.v_Color=x_e11, .v_TexCoord=x_e13, .member=x_e15};
return tint_symbol_4;
}
vertex tint_symbol_3 tint_symbol(const constant ub_PacketParams* tint_symbol_32 [[buffer(0)]], const constant ub_SceneParams* tint_symbol_33 [[buffer(1)]], const constant ub_MaterialParams* tint_symbol_36 [[buffer(2)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float3 tint_symbol_27 = 0.0f;
thread float2 tint_symbol_28 = 0.0f;
thread float4 tint_symbol_29 = 0.0f;
thread float3 tint_symbol_30 = 0.0f;
thread float tint_symbol_31 = 0.0f;
thread float4 tint_symbol_34 = 0.0f;
thread float4 tint_symbol_35 = 0.0f;
thread float2 tint_symbol_37 = 0.0f;
VertexOutput const inner_result = tint_symbol_inner(tint_symbol_1.a_Position, tint_symbol_1.a_UV, tint_symbol_1.a_Color, tint_symbol_1.a_Normal, tint_symbol_1.a_PosMtxIdx, &(tint_symbol_27), &(tint_symbol_28), &(tint_symbol_29), &(tint_symbol_30), &(tint_symbol_31), tint_symbol_32, tint_symbol_33, &(tint_symbol_34), &(tint_symbol_35), tint_symbol_36, &(tint_symbol_37));
tint_symbol_3 wrapper_result = {};
wrapper_result.v_Color = inner_result.v_Color;
wrapper_result.v_TexCoord = inner_result.v_TexCoord;
wrapper_result.member = inner_result.member;
return wrapper_result;
}