SPIRV-Cross/reference/shaders-msl/vert/packed_matrix.vert
Chip Davis 28454facbb MSL: Handle packed matrices.
The old method of using a different unpacked matrix type doesn't work
for scalar alignment. It certainly wouldn't have any effect for a square
matrix, since the number of columns and rows are the same. So now we'll
store them as arrays of packed vectors.
2019-07-10 18:37:31 -05:00

58 lines
1.1 KiB
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
typedef packed_float4 packed_rm_float4x3[3];
struct _15
{
packed_rm_float4x3 _m0;
packed_rm_float4x3 _m1;
};
struct _42
{
float4x4 _m0;
float4x4 _m1;
float _m2;
char _m3_pad[12];
packed_float3 _m3;
float _m4;
packed_float3 _m5;
float _m6;
float _m7;
float _m8;
float2 _m9;
};
struct main0_out
{
float3 m_72 [[user(locn0)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float4 m_25 [[attribute(0)]];
};
vertex main0_out main0(main0_in in [[stage_in]], constant _15& _17 [[buffer(0)]], constant _42& _44 [[buffer(1)]])
{
main0_out out = {};
float3 _91;
float3 _13;
do
{
_13 = normalize(float4(in.m_25.xyz, 0.0) * float3x4(float4(_17._m1[0]), float4(_17._m1[1]), float4(_17._m1[2])));
break;
} while (false);
float4 _39 = _44._m0 * float4(float3(_44._m3) + (in.m_25.xyz * (_44._m6 + _44._m7)), 1.0);
out.m_72 = _13;
float4 _74 = _39;
_74.y = -_39.y;
out.gl_Position = _74;
return out;
}