What are the rules to align a struct according to std430?
I have this struct on the CPU side:
struct material {
vec3 kd;
vec3 ks;
vec2 alpha; // Anisotropic roughness
vec3 emission;
vec3 emissionStrength;
};
Where should I add padding and how much should I add so that this can be sent to this ssbo:
GPU code:
struct Material {
vec3 kd;
vec3 ks;
vec2 alpha;
vec3 emission;
vec3 emissionStrength;
};
layout (std430, binding = 1) buffer Materials {
Material materials[];
};
Also, how do I ensure that all the array's individual elements are also aligned?