PDA

View Full Version : Shader buffer storage: second set of uniform cause INVALID_OPERATION



YarUnderoaker
04-15-2013, 02:44 AM
Hi.
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

Alfonse Reinheart
04-15-2013, 03:14 AM
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.

YarUnderoaker
04-15-2013, 05:31 AM
Well, it's all kind of hard to tell without seeing the actual code where you're getting these errors.
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 don't see what this has to do with a storage buffer; how uniforms works is an entirely orthogonal issue.
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.

YarUnderoaker
04-16-2013, 01:50 AM
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: