NVIDIA or AMD driver bug with uniform names for block uniforms
Consider the following code, which prints out the name of uniforms in a program:
glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &numUniforms);
std::cout << "Num uniforms: " << numUniforms << "\n";
for(int ix = 0; ix < numUniforms; ++ix)
glGetActiveUniformsiv(program, 1, (GLuint*)&ix, GL_UNIFORM_NAME_LENGTH, &length);
glGetActiveUniformName(program, ix, length, NULL, &str);
std::string name(str.begin(), str.end());
std::cout << ix << ":\t" << name << "\n";
Now considering the following Vertex Shader:
uniform float a_name;
in vec3 position;
gl_Position.xyz = position.xyz * a_name * instance_name.a_name;
gl_Position.w = 1.0;
If the fragment shader has no other uniforms, we would expect to see 2 uniforms come out of this code. And on both NVIDIA and AMD drivers, I do. The problem is what they're named.
On AMD, they're called "a_name" and "instance_name.a_name". On NVIDIA, they're called "a_name" and "BlockName.a_name".
I'm fairly sure NVIDIA is correct here, but I can't say that they are because... the actual OpenGL spec does not say. Or if it does, I certainly can't find it.
So one of them is wrong. Or maybe both are. I don't know. Does anyone know? Will the ARB ever bother clarifying it?