What are the rules for the alignment of structs within structs in Metal? I cannot find it documented anywhere in the shading language specification. And do structs have any minimum size & alignment constraints? (I need to generate memory layouts before the shaders are compiled, so using the reflection API is not an option).
e.g. I have the following
struct S0
{
float4x4 A;
float4x4 B;
float3x3 C;
float4 D;
};
struct M0
{
float A;
};
struct N0
{
float A;
};
struct Uniforms
{
N0 nor0;
M0 mut0;
S0 su;
};
What would the expected alignments be? Should I assume they follow standard C++ behaviour?
e.g.
offsetof(Uniforms, N0) == 0
offsetof(Uniforms, M0) == 4
offsetof(Uniforms, S0) == 16
Thx - j