A Shader Storage Buffer Object (SSBO) is an indexed Buffer Object available since OpenGL 4.3. It can be used to read/write arbitrarily structured data from shaders.
SSBOs work similar to Uniform Buffer Objects but can be much larger, like Buffer Textures but with the benefit of being defined with an arbitrary structure:
struct StructureName {
vec4 position;
float length;
int count;
};
layout(std430, binding=0) buffer BlockName {
StructureName variableName;
int indices[];
};
As seen in the above example they allow for a trailing array member that expands to the remaining size of the bound buffer. The number of elements in the array can be retrieved via the indices.length()
.
The type of the array elements can also be a struct.
In compare to Uniform Buffer Objects, Shader Storage Buffer Objects are writable.