I have two sampler arrays in my fragment shader:
uniform sampler2D shadowMaps[12];
uniform samplerCubeShadow shadowMapsCube[12];
This works fine on my pc with opengl 4.2, however on my laptop (opengl 3.1) I'm getting the error 'array size too big'.
If I set it to 8, it works fine. Arrays of other types can be far larger however, and I can add more sampler arrays with a max size of 8 without a problem. So, how is this limit determined?
After lowering the array size to 8 the compilation works, but the linking fails silently (The log is empty and glGetError() returns 0).
If I declare each sampler individually (uniform sampler2D shadowMap1;uniform sampler2D shadowMap2; etc.), neither of these errors occur.
You have to take two things into account.
First, bear in mind that depending on your OpenGL version, accessing to samplers array using variables inside loops is not permited. See: https://stackoverflow.com/a/12031821/988027
Secondly, quoting from the OpenGL wiki page, there are a maximum amount of texture units you can use at the same time:
OpenGL contexts have a maximum number of texture image units, queriable from the constant GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS.
Probably, this answer will help you. Particularly, have a look at the shader resource limitations.