Bug 74819 - Using a shared global uniform struct in both vertex and fragment shader prevents the program from linking
Summary: Using a shared global uniform struct in both vertex and fragment shader preve...
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 10.0
Hardware: Other All
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-11 02:38 UTC by Arseny Kapoulkine
Modified: 2019-09-18 19:45 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch for glsl/linker.cpp that fixes the issue (1.89 KB, text/plain)
2014-02-11 02:38 UTC, Arseny Kapoulkine
Details

Description Arseny Kapoulkine 2014-02-11 02:38:58 UTC
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.
Comment 1 Ian Romanick 2014-02-12 18:45:57 UTC
Is this a regression?  What version of Mesa did you test?  Commit 955c93d made some changes in this area.
Comment 2 Arseny Kapoulkine 2014-02-12 18:55:06 UTC
(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.
Comment 3 GitLab Migration User 2019-09-18 19:45:17 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/802.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.