79310922

Date: 2024-12-27 04:51:28
Score: 1
Natty:
Report link

@pezcode The 16-byte "stride" comes from the size of the struct if the you declare an array based on that struct.

For example, under both std140 and std430, the size of struct foo { uint x; uvec2 y; } is 16-byte (i.e. there is a 4-byte internal padding after uint x;).

But if you declare an array like this struct foo { uint x; uvec2 y; } bar[5], its base alignment would be 8-byte under std430 (which comes from its member uvec2 y;, i.e. the member with the largest base alignment). Under std140, the base alignment of bar[5] will be rounded up to 16-byte. i.e. both its base-alignment and stride are 16 bytes. While under std430, its base-alignment (8-byte) is different from its stride (16-byte).

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @pezcode
  • Low reputation (1):
Posted by: George Gan