SPIRV-Cross/reference/opt/shaders-msl/vert/ubo.alignment.vert
Hans-Kristian Arntzen 8c632da461 MSL: Use correct alignment rule for whole structs.
Structs are aligned as you would expect in MSL (maximum member
alignment), and it is not minimum 16 bytes like in std140.

Also rename the dummy "pad" members to a reserved naming scheme.
2019-01-28 15:20:30 +01:00

39 lines
749 B
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct UBO
{
float4x4 mvp;
float2 targSize;
char _m2_pad[8];
packed_float3 color;
float opacity;
};
struct main0_out
{
float3 vNormal [[user(locn0)]];
float3 vColor [[user(locn1)]];
float2 vSize [[user(locn2)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float4 aVertex [[attribute(0)]];
float3 aNormal [[attribute(1)]];
};
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]])
{
main0_out out = {};
out.gl_Position = _18.mvp * in.aVertex;
out.vNormal = in.aNormal;
out.vColor = float3(_18.color) * _18.opacity;
out.vSize = _18.targSize * _18.opacity;
return out;
}