Using a shared global uniform struct in both vertex and fragment shader prevents the program from linking
Submitted by Arseny Kapoulkine
Assigned to Ian Romanick
Created attachment 93822 Patch for glsl/linker.cpp that fixes the issue
The GLSL specification says that it's valid to have a global that's using a structure in both vertex and fragment shader, as long as the structure definition (name, field names and field types) matches.
Mesa GLSL linker does not do this analysis and instead just flags this as an error in cross_validate_globals.
Additionally, the spec allows global explicitly sized arrays with the same name; looks like this case is not handled as well.
I'm attaching a patch that resolves this by verifying that struct/array field/order matches before giving the error.
Attachment 93822, "Patch for glsl/linker.cpp that fixes the issue":