<html><body>Hello,<br>just recently I encountered a problem when linking
shaders, containing uniform consisting of anonymous structure.<br>Here is the
code of shaders, triggering the problem:<br>//vertex shader<br>uniform struct
{vec3 a; vec3 b;} a;<br>void main()<br>{<br> gl_Position =
gl_ModelViewProjectionMatrix * gl_Vertex;<br>}<br><br>//fragment
shader<br>uniform struct {vec3 a; vec3 b;} a;<br>void main()<br>{<br>
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);<br>}<br><br>The error message pops up
when linking is performed:<br>error: uniform `a' declared as type
`#anon_struct_0002' and type `#anon_struct_0001'<br><br>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.<br><br>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?<br>Thank you,<br><br>Michal Navratil<br></body></html>