[Mesa-dev] [PATCH] glsl/linker: Allow mixing of desktop GLSL versions.

Paul Berry stereotype441 at gmail.com
Sat Oct 19 17:15:51 CEST 2013


On 18 October 2013 11:07, Ian Romanick <idr at freedesktop.org> wrote:

> On 10/17/2013 08:07 PM, Paul Berry wrote:
> > 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}".
>
> Are there any piglit tests that now fail?  It seems like we may have had
> one or two tests that verify the (old) spec behavior...
>

I would have thought so, but I just did a full piglit run and didn't get
any regressions, so I guess not.


>
> You should ping the reporter of this bug:
>
> https://bugs.freedesktop.org/show_bug.cgi?id=70261
>
> This should fix his problem as well.
>

Good call.  I'll do that once I've landed the patch.


>
> > ---
> >  src/glsl/linker.cpp | 10 +++-------
> >  1 file changed, 3 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> > index 9095a40..0a949b4 100644
> > --- a/src/glsl/linker.cpp
> > +++ b/src/glsl/linker.cpp
> > @@ -2057,14 +2057,10 @@ link_shaders(struct gl_context *ctx, struct
> gl_shader_program *prog)
> >        }
> >     }
> >
> > -   /* Previous to GLSL version 1.30, different compilation units could
> mix and
> > -    * match shading language versions.  With GLSL 1.30 and later, the
> versions
> > -    * of all shaders must match.
> > -    *
> > -    * GLSL ES has never allowed mixing of shading language versions.
> > +   /* In desktop GLSL, different shader versions may be linked
> together.  In
> > +    * GLSL ES, all shader versions must be the same.
> >      */
> > -   if ((is_es_prog || max_version >= 130)
> > -       && min_version != max_version) {
> > +   if (is_es_prog && min_version != max_version) {
> >        linker_error(prog, "all shaders must use same shading "
> >                  "language version\n");
> >        goto done;
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131019/0b2a085c/attachment-0001.html>


More information about the mesa-dev mailing list