Bug 30261

Summary: [GLSL 1.20] allowing inconsistent invariant declaration between two vertex shaders
Product: Mesa Reporter: Gordon Jin <gordon.jin>
Component: Mesa coreAssignee: Ian Romanick <idr>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: medium CC: chadversary, idr, kenneth
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: new piglit case
Proposed bug fix

Description Gordon Jin 2010-09-19 00:06:52 UTC
Created attachment 38793 [details] [review]
new piglit case

GLSL 1.20 section 4.3.6 says:
The type and presence of the invariant qualifiers of varying variables with the same name declared in linked vertex and fragments shaders must match, otherwise the link command will fail.

GLSL 1.50 section 4.6.1 says more clearly:
For variables leaving one shader and coming into another shader, the invariant keyword has to be used in both shaders, or a link error will result.

The mesa glsl compiler fails link correctly for one vertex shader and one fragment shader.

But it links (incorrectly) successfully for two vertex shaders.

This also exists in the old glsl compiler. So I'm not marking this as release blocker.

Tested on Piketon (i965) with mesa master ca92ae2699c4aad21c0811b9a5562b9223816caf.

New piglit case attached.

(This issues also applies for centroid. I'll add a new case for it after this one gets handled.)
Comment 1 Gordon Jin 2010-11-14 18:03:25 UTC
Ian, can you review this?
Comment 2 Ian Romanick 2010-11-17 12:50:19 UTC
Linking should fail in this test case.
Comment 3 Chad Versace 2010-11-17 14:40:09 UTC
Created attachment 40347 [details] [review]
Proposed bug fix

This patch causes the Piglit test case to pass.
Comment 4 Chad Versace 2010-11-17 14:44:51 UTC
Review of attachment 38793 [details] [review]:

Git fails to apply this to Piglit master. I've (chad) submitted a new patch which can be successfully applied.
Comment 5 Chad Versace 2010-11-17 14:49:43 UTC
(In reply to comment #4)
RETRACT comment #4. It was an accidental post.
Comment 6 Vinson Lee 2010-11-24 22:48:32 UTC
I've committed the test case from attachment id=38793 to piglit.
Comment 7 Chad Versace 2010-12-01 20:50:16 UTC
Fixed by Mesa commit 7528f143dfb77e3e0486006676e990964392aebf.
Change status to RESOLVED/FIXED.
Comment 8 Gordon Jin 2010-12-02 16:42:08 UTC
verified:

commit 7528f143dfb77e3e0486006676e990964392aebf
Author:     Chad Versace <chad.versace@intel.com>
AuthorDate: Wed Nov 17 14:34:38 2010 -0800
Commit:     Chad Versace <chad.versace@intel.com>
CommitDate: Wed Dec 1 20:40:07 2010 -0800

    glsl: Fix linker bug in cross_validate_globals()
    
    Cause linking to fail if a global has mismatching invariant qualifiers.

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.