isInStd430Layout
Evaluates if the vertex format adheres to the std430
memory layout rules.
The std430
layout requires proper alignment of each data type based on its size and characteristics. It ensures that:
The alignment of each item within the layout matches the specified alignment for its type.
The vertex size respects the maximum alignment of all items.
The determination involves validating the alignment of offsets for each item in items
based on their type and verifying that size
is aligned with the computed maxAlign
value.
The alignment rules are derived as follows:
Matrices (
MATRIX33_FLOAT32
,MATRIX44_FLOAT32
,MATRIX22_FLOAT32
) and 4-component vector types (VECTOR4_UINT32
,VECTOR4_FLOAT32
,VECTOR4_INT32
) have an alignment of 16 bytes.3-component vectors (
VECTOR3_UINT32
,VECTOR3_FLOAT32
,VECTOR3_INT32
) have an alignment of 16 bytes.2-component vectors (
VECTOR2_UINT32
,VECTOR2_FLOAT32
,VECTOR2_INT32
) have an alignment of 8 bytes.Scalars (
FLOAT32
,UINT32
,INT32
) have an alignment of 4 bytes.
If any item or the overall vertex size violates the alignment rules, the result will be false
.
Return
true
if the vertex format satisfies the alignment constraints of the std430
layout, otherwise false
.