I've recently discovered that there is a limit to the size of uniform arrays. I have a number of float array uniforms and have discovered that I can increase their collective size by 6 before the shader stops working. Doesn't matter which array I make bigger. Now... I really need them to be bigger. How can I circumvent this limitation? I am using #version 330 core, if that helps.
2 Answers
You can't. It's a specification of GLSL. It's like asking "How can I have an int
bigger than INT_MAX
?". Literally not possible.
You can try redesigning your uniforms so there are more than one and they are logically split up into related values instead of just lumping them all into one.

- 10,297
- 11
- 59
- 88
The limitation is given by the GPU and/or the driver. If you exceed the limits of uniforms then the data is not suitable for uniforms. Even if there is a hack to get around that limitation, you shouldn't do that, the limitation likely exists for a reason.
With OpenGL 4.3 or newer (or if supported by extensions) you can use SSBOs, which are designed to pass a large amount of data to the shader.
If you can't use that you need to use workarounds like saving your data in a texture and writing a function in GLSL that extracts that data from the texture again.

- 39,256
- 9
- 74
- 101