Bug 70261 - error: all shaders must use same shading language version
Summary: error: all shaders must use same shading language version
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 9.2
Hardware: Other All
: medium normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-07 23:54 UTC by Michael Gratton
Modified: 2013-10-22 14:44 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Michael Gratton 2013-10-07 23:54:12 UTC
When loading the native Linux game "Planetary Annihilation" the following error is reported:

> error: all shaders must use same shading language version

This prevents key shaders from being loaded, making the game somewhat unusable.

It may be another case of Mesa being overly strict compared to the spec and other implementations, since the proprietary drivers have no issue with it.
Comment 1 Michael Gratton 2013-10-08 05:11:09 UTC
On digging into this further, the application may be at fault - it loads shaders declaring "#version 130" with those containing no version directive, and hence default to version 110.

I guess the right thing to do here depends on whether adherence to the spec or compatibility with proprietary implementations is more important.
Comment 2 Ian Romanick 2013-10-08 22:14:37 UTC
Are these shaders in the same stage or different stages?

We've always taken a pretty hard line on following the spec.  In cases where the spec doesn't match *any* implementation, we've worked to change the spec.  The 4.4 spec contains (at least) one such change.  The version matching requirement between stages has been relaxed.

If this is the issue the app is hitting, we can change Mesa to match the 4.4 rules.
Comment 3 Michael Gratton 2013-10-08 22:55:25 UTC
It is mixing 130 with 110 (by default), both texture and vertex. I think the spec is pretty clear that this should be an error.
Comment 4 Paul Berry 2013-10-22 14:44:04 UTC
(In reply to comment #3)
> It is mixing 130 with 110 (by default), both texture and vertex. I think the
> spec is pretty clear that this should be an error.

By a complete coincidence, I've been investigating the same issue as part fo my work implementing GLSL 1.50 support in Mesa.  Although the GLSL 1.30 spec is quite clear that cross-version linking should be restricted in this way, no major implementation (other than Mesa) has ever enforced this.  Because of this, the Khronos group dropped the cross-version linking restriction from GLSL 4.30.  After some discussion on mesa-dev, we agreed that we should drop it from Mesa too, even though Mesa doesn't implement GLSL 4.30 yet.

The bug should be fixed by commit 672fab0b1bdffbbdf689f8494c798f868d4d84a4
Author: Paul Berry <stereotype441@gmail.com>
Date:   Sun Oct 13 18:01:11 2013 -0700

    glsl/linker: Allow mixing of desktop GLSL versions.
    
    Previously, Mesa followed the linkage rules outlined in the GLSL
    1.20-1.40 specs, which (collectively) said that GLSL versions 1.10 and
    1.20 could be linked together, but no other versions could be linked.
    
    In GLSL 4.30, the linkage rules were relaxed so that any two desktop
    GLSL versions can be linked together.  This change was made because it
    reflected the behaviour of nearly all existing implementations (see
    Khronos bug 8463).  Mesa was one of the few (perhaps the only)
    exceptions to prohibit cross-linking of some GLSL versions.
    
    Since the GLSL linkage rules were deliberately relaxed in order to
    match the behaviour of existing implementations, it seems appropriate
    to relax the rules in Mesa too (even though Mesa doesn't support GLSL
    4.30 yet).
    
    Note that linking ES and desktop shaders is still prohibited, as is
    linking ES shaders having different GLSL versions.
    
    Fixes piglit tests "shaders/version-mixing {interstage,intrastage}".
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Eric Anholt <eric@anholt.net>


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.