I cannot get the following structure to work when using it in Shader Storage Object:
Definitions in shader:
struct Object
{
vec4 color;
mat3 transform;
float depth;
float pObjIndex;
//float align1;
//float align2;
};
layout (std430, binding = 0) buffer Objects
{
Object objects[];
};
It's my understanding that the Object structure is aligned in GLSL by its largest member which is vec4, i.e. by 16-byte boundary. (mat3 is treated as 3-element array of vec3's and is aligned by 12-bytes boundary). The vec4, mat3 and 2 floats give 72 bytes. When I pad the structure to the nearest 16-byte multiple - 80 - with two floats, it's not working properly just as without padding.
Are both variants of this structure's layout - with padding with 2 floats and without any padding - incorrect?