I'm using the compute shader bound with a SSAO. And I use the following structure in the compute shader:
struct Particle
{
vec4 pAnds;
vec3 velocity;
float lifespan;
float age;
};
layout (std430, binding = 0) buffer members_in
{
Particle particle[];
} input_data;
yet it seems that the memory block allocated for each of these data structure is not equal to (4 + 3 + 1 + 1) * 4. And I also tried another one:
struct Particle
{
vec4 pAnds;
vec3 velocity;
float lifespan;
};
This time it worked fine. I was wondering how the memory is allocated with std430 qualifier. How to make my first data structure work just as the second one?
updated: I changed it to the following form:
struct Particle
{
float px, py, pz, s;
float vx, vy, vz;
float lifespan;
float age;
};
This time it worked fine, but I still have no idea why there's problem using vec4 / vec3.