Can you see any problem with my C++ and GLSL structures here? I am using std430 layout to store these in a shader storage buffer. sizeof(GPUMaterial) is 208 and offsetof(GPUMaterial, textureHandle) equals 80.
C++
struct GPUMaterial
{
float diffuseColor[4];
float metalnessRoughness[2];
float emissiveColor[3]; uint32_t flags;
float texturescroll[3]; float alphacutoff;
float displacement[2];
float specular[3], gloss;
GLuint64 texturehandle[16];
};
GLSL:
struct Material
{
vec4 diffuseColor;
vec2 metalnessRoughness;
vec3 emissiveColor;
uint flags;
vec3 texturescroll;
float alphacutoff;
vec2 displacement;
vec4 speculargloss;
uvec2 textureHandle[16];
};
The storage buffer is declared like this:
layout(std430, binding = STORAGE_BUFFER_MATERIALS) readonly buffer MaterialBlock { Material materials[]; };