Created attachment 93822 [details]
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.
Is this a regression? What version of Mesa did you test? Commit 955c93d made some changes in this area.
(In reply to comment #1)
> Is this a regression? What version of Mesa did you test? Commit 955c93d
> made some changes in this area.
This has been a problem with both Mesa 9.1 and Mesa 10.0.3; AFAICT this is not a regression and just a bug. I changed "Version" field in the bug to 10.0 to reflect this.
Commit 955c93d looks like it solves a similar issue.
Note that it's still wrong - it does not compare struct fields types recursively, and it does not solve the problem of fixed size arrays with the same size.
I think it probably solves my specific problem (I'll have to test HEAD to verify that) but does not result in a spec-compliant solution.