Shader buffer storage: second set of uniform cause INVALID_OPERATION

Here is shader code

layout(std430, binding = 4) buffer MVMatrix 
 mat4 ModelView[];
} mvMat;

uniform int ObjectIndex;
vec4 pos = mvMat.ModelView[ObjectIndex] * vec4(in_Position, 1.0);

To mvMat binded range of buffer with type GL_SHADER_STORAGE_BUFFER. Buffer size is 65556 (1024 matrices)

First set of ObjectIndex to any value is OK
Second set of ObjectIndex to any value get GL_INVALID_OPERATION error generated. Wrong component type or count.

This message I get from DebugCallback, when execution point return from callback to place after glUniformi1

Also glGetProgramResourceiv for GL_TOP_LEVEL_ARRAY_SIZE return zero.

Graphic driver is GeForce 314.21 beta

Well, it’s all kind of hard to tell without seeing the actual code where you’re getting these errors. Also, I don’t see what this has to do with a storage buffer; how uniforms works is an entirely orthogonal issue.

I agree, but it is hard to cut code from framework and make it clear to all. My hope is that someone faced a similar problem.

I think most likely problem in driver - it can’t properly setup index for array through uniform or can’t properly calculate array length from buffer size.

I will try to make a simple demo with raw GL for better understanding.

gDebugger help me.
Error was trivial - second setting of uniform was happens for other shader program where not that uniform.
So there is no driver bug, only curved hands :whistle:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.