I have following structure which i use as an uniform buffer object.
struct GlobalShaderData
{
#define CLUSTER_X_MAX 16
#define CLUSTER_Y_MAX 8
#define CLUSTER_Z_MAX 8
#define CLUSTER_MAX_LIGHTS 4
int pointLightIndices[CLUSTER_X_MAX * CLUSTER_Y_MAX * CLUSTER_Z_MAX * CLUSTER_MAX_LIGHTS];
int pointLightsPerTile[CLUSTER_X_MAX * CLUSTER_Y_MAX * CLUSTER_Z_MAX];
};
GlobalShaderData globalShaderData;
The total size of the first int array should be 4 bytes * 16 * 8 * 8 * 4 = 16384 bytes, thus the maximum ubo memory is not exceeded.
However, when compiling the shaders I receive an "out of resource" error message.
I guess the integer actually takes 16 bytes on the glsl side to align with a vec4. Because if we calculate with 16 bytes * 16 * 8 * 8 * 4 = 65536 bytes, which just exceedes the maximum capacity.
What are my options to have an smaller integer array on glsl side.
(I know that I could use other storage buffers but thats not relevant to the question.)
globalShaderData
variable isn't even a uniform. $\endgroup$