Be ready to split some hairs :).
Take the following struct
struct Bleh {
mat4 a;
vec3 b;
}
Crevice interprets this struct as being of size 76, via calling std140_size_static.
This goes against what both the wgsl and GL spec specify, asking for a size of 80 (roundUp(16, 64 + 12)). It also interprets this struct as size 80 instead of the proper size 96.
struct Other {
Bleh a;
f32 b;
}
wgsl:
The size of a structure is equal to the offset plus the size of its last member, rounded to the next multiple of the structure’s alignment:
SizeOf(S) = roundUp(AlignOf(S), OffsetOf(S, L) + SizeOf(S, L))
Where L is the last member of the structure
GL:
The structure may have padding at the end;the base offset of the member following the sub-structure is rounded up to the next multiple of the base alignment of the structure.
This GL spec rules only applies to the context of it being a member. Wgsl specifies this for both being a member and a top level struct. The GL spec does not say the size of the struct when it is a top level struct. Because of this omission, it should be valid to always interpret the size of this struct as 80.
This should make everyone agree, then we can live a happy life away from all this hair splitting and spec reading.
Be ready to split some hairs :).
Take the following struct
Crevice interprets this struct as being of size 76, via calling
std140_size_static.This goes against what both the wgsl and GL spec specify, asking for a size of 80 (
roundUp(16, 64 + 12)). It also interprets this struct as size80instead of the proper size96.struct Other { Bleh a; f32 b; }wgsl:
GL:
This GL spec rules only applies to the context of it being a member. Wgsl specifies this for both being a member and a top level struct. The GL spec does not say the size of the struct when it is a top level struct. Because of this omission, it should be valid to always interpret the size of this struct as 80.
This should make everyone agree, then we can live a happy life away from all this hair splitting and spec reading.