GLSL uvec2 array packing

I have my material structure defined as follows:

struct Material
{
	vec4 diffuseColor;
	vec4 metalnessRoughness;
	vec4 emissiveColor;
	uvec2 textureHandle[16];
};

Is the textureHandle array going to be tightly packed, or are there 8 extra bytes between each element of the array?

Which layout are you using? std140 or std430?

1 Like

Also note that if you want std430 on UBOs, this may be an option:

Well I added std430 to the storage buffer definition, but it does not appear to be working. There might still be an error on my part:

layout(std430, binding = STORAGE_BUFFER_MATERIALS) readonly buffer MaterialBlock { Material materials[]; };

Okay, it works, I just had one odd texture format that wasn’t initializing correctly.