0

So I have this problem that

glGetActiveUniformsiv​(<program>, <ucount>, <indicesptr>, GL_UNIFORM_SIZE, <retptr>)
glGetActiveUniform(<program>, ...)

Returns always just 1 as uniform array length even if I declared an array of length 8 in the shader. Also I do access the array contents in the shader as the uniforms are otherwise reported okay by these funcs.

I think my driver (I have ATI Radeon 5750 HD and recent drivers) violates the GL 3.3 spec:

"If pname is UNIFORM_SIZE, then an array identifying the size of the uniforms
specified by the corresponding array of uniformIndices is returned. The sizes
returned  are in units of the type returned by a query of UNIFORM_TYPE. For active
uniforms that are arrays, the size is the number of active elements in the array; for
all other uniforms, the size is one."

Am I right so far or doesn't your driver report 1 as array length? It does not matter if the uniforms are in block or not. I still get just 1. The only option I have would be parsing the uniform names to get the maximum array index available. This will be complex as it must support all array phases in GLSL. I need the array size in C++ program side to initialize enough resources for the shader.

Btw.. I could see that phase "all (other) uniforms, the size is one" may be misleading for some folks..

4

0 回答 0