Hello,
just recently I encountered a problem when linking shaders, containing 
uniform consisting of anonymous structure.
Here is the code of shaders, triggering the problem:
//vertex shader
uniform struct {vec3 a; vec3 b;} a;
void main()
{
  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

//fragment shader
uniform struct {vec3 a; vec3 b;} a;
void main()
{
  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

The error message pops up when linking is performed:
error: uniform `a' declared as type `#anon_struct_0002' and type `#anon_
struct_0001'

The problem is, that each anonymous structure gets its own unique type, 
without checking if such type already exists. It seems to me, that such code
is somewhat in the gray area - the rest of OpenGL implementations doesn't 
seem to have a problem with this code (Intel on Win, OSX, Nvidia and AMD 
drivers in Win, OSX and Linux), which of course doesn't mean such a behavior
is correct.

I'd like to ask you, what is your take on this? Should anonymous structs be 
checked against ones seen already and the type name reused when suitable one
is found?
Thank you,

Michal Navratil
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to