<div dir="ltr">On 16 October 2013 22:30, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 10/16/2013 04:56 PM, Ian Romanick wrote:<br>
> On 10/16/2013 10:29 AM, Paul Berry wrote:<br>
>> ---<br>
>><br>
>> I'm not 100% sure this is the right way to go, and here's why:<br>
>><br>
>> Taken together, all the GLSL specs except GLSL 4.30 and GLSL 4.40 tell<br>
>> a consistent story: desktop shader versions 1.10 and 1.20 may be<br>
>> linked together, and desktop shader versions 1.40 and above may be<br>
>> linked together.  No other cross-version linking is allowed.<br>
>><br>
>> However, cross-version linking restrictions were explicitly removed in<br>
>> GLSL 4.30 (the change is listed under "Summary of Changes from Version<br>
>> 4.20 as "Remove cross-version linking restrictions.").  GLSL 4.30 and<br>
>> 4.40 state that *any* version of desktop GLSL may be linked with any<br>
>> other version of desktop GLSL.  (Note that cross-version linking is<br>
>> still prohibited for ES shaders).<br>
><br>
> This came from a Khronos bug that I submitted.  The problem is that no<br>
> other driver enforces the spec mandated restriction.  On top of that,<br>
> you can't fully enforce the restriction (without draw-time errors) with<br>
> separate shader objects.  I *thought* the change in 4.3 was to allow<br>
> mixed versions between stages, but mixing versions within a stage is<br>
> still forbidden.<br>
><br>
>> This leads to a conundrum.  Normally when the GLSL spec changes from<br>
>> one version to the next, we implement different rules depending on the<br>
>> user-supplied "#version" directive.  But we can't do that for<br>
>> cross-version linking rules since it's not clear which version of GLSL<br>
>> should apply.  Should we:<br>
>><br>
>> (a) always follow pre-GLSL 4.30 linking rules, since we don't support<br>
>> GLSL 4.30 yet?  (that's what this patch implements).<br>
>><br>
>> (b) always follow post-GLSL 4.30 linking rules, since they're probably<br>
>> the clearest reflection of the Khronos board's intent?<br>
>><br>
>> (c) make some kind of dynamic determination of which set of rules to<br>
>> follow?<br>
>><br>
>> FWIW, the NVIDIA proprietary driver for Linux (version 313.18) appears<br>
>> to implement (b).<br>
><br>
> There are different cases: intrastage and interstage.  I assume they<br>
> allow mixing interstage.  What about intrastage?<br>
<br>
</div></div>I ran a quick test on my AMD Radeon 6870, using Catalyst 13.10 (which<br>
supports 4.30).  It allowed both kinds of linking.  Here's my test:<br>
<br>
[require]<br>
GL >= 2.1<br>
GLSL >= 1.10<br>
<br>
[vertex shader]<br>
#version 400 compatibility<br>
<br>
void main()<br>
{<br>
    gl_Position = gl_Vertex;<br>
}<br>
<br>
[fragment shader]<br>
#version 330 core<br>
uniform vec4 color;<br>
<br>
vec4 get_color()<br>
{<br>
    return color;<br>
}<br>
<br>
[fragment shader]<br>
#version 110<br>
vec4 get_color();<br>
<br>
void main()<br>
{<br>
    gl_FragColor = get_color();<br>
}<br>
<br>
[test]<br>
uniform vec4 color 0 1 0 1<br>
draw rect -1 -1 2 2<br>
relative probe rgba (0.5, 0.5) (0.0, 1.0, 0.0, 1.0)<br>
</blockquote></div><br></div><div class="gmail_extra">Ok, thanks Ken.  Based on the NVIDIA results, and further discussion with Ian this morning, I'm going to NAK this patch and follow up with a patch that allows all desktop GLSL versions to be inter-linked.<br>
<br></div><div class="gmail_extra">(BTW, for any Khronos members, the Khronos bug that led to this change is bug 8463)<br></div></div>