My question is close to this one What is the actual number of vertex uniform components for GLSL shader on ATI graphics card?
In his case,
- he had a GL_MAX_VERTEX_UNIFORM_COMPONENTS of 4096
- he was using a mat4[] array
- below 64 mat4, shader is fine, above, it isn't
As written on the wiki, on amd card, to obtain the correct value, it should be divided by 4, wich gave him 4096/4 = 1024 floats.
As a mat4 is 16 floats, he then divided it by 16, which gave him 1024/16 = 64 mat4.
So the limit is coherent with his use.
But it's not with mine, here's what i have:
- GL_MAX_VERTEX_UNIFORM_COMPONENTS: 16384
- array of vec3
I'm using vectors to translate instances of a cube, so the number of vectors is equals to the number of instances passed to glDrawArraysInstanced() .
The code is really just gl_Position = vp * translateVec[gl_InstaceID] * pos
(with vp a unique ViewProjection matrix).
If there are less than 256 vectors, the cubes are correctly translated.
Above 256 vectors, the first 256 cubes are ok but all the others are not, they are located at (0, 0, 0) point, looks like the vectors are (0, 0, 0).
I have an amd 6490m so like him, i should do the division by 4 step 16384/4 = 4096 floats
The wiki says that due to the vector architecture, "you should assume that each separate uniform takes up 4 components". This means that a vec3 will use 4 components instead of 3.
So 4096/4 = 1024 vec3
As you see, it isn't coherent with my observation.
What am i missing ? And also what about GL_MAX_UNIFORM_VECTORS (4096 for me) ?
Notes: I upload the vec3 array with glUniform3fv()
and the array is declared with uniform vec3[255]
Core profile 4.2, win7, 13.1 catalyst.