OpenGL, SSBO std430 padding byte size

48 Views Asked by At

This is the fragment shader code which is including struct and buffer data:

struct Light
{
    float range;
    vec3 position;  
    vec3 color;
};

layout (std430) buffer LocalLights
{
    uint activeLightCount;
    Light light[];
} localLights;

If I assume that the light[] is total 10, what is total size of LocalLights data and the Light struct size data?

I want to use these function:

glBufferData(GL_SHADER_STORAGE_BUFFER, size, data, GL_DYNAMIC_COPY);
glBufferSubData(GL_SHADER_STORAGE_BUFFER, offset1, activeLightCountSize, data_of_count);
glBufferSubData(GL_SHADER_STORAGE_BUFFER, offset2, totalLightStructSize, data_of_array);

For example: If I have the array which is std::vector data_of_array and assumes this vector has 10 element. In this case, what is size of activeCountSize, offset2, totalLightStructSize?

Try to get size of data. Get total size of LocalLights data and the Light struct size data?

0

There are 0 best solutions below