<div dir="ltr">On 16 October 2013 14:19, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">On 10/16/2013 02:04 PM, Paul Berry wrote:<br>
> On 16 October 2013 13:50, Ian Romanick <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a><br>
</div><div class="im">> <mailto:<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>>> wrote:<br>
><br>
> On 10/16/2013 01:46 PM, Ian Romanick wrote:<br>
> > On 10/16/2013 07:43 AM, Paul Berry wrote:<br>
> >> On 16 October 2013 00:26, Jordan Justen <<a href="mailto:jljusten@gmail.com">jljusten@gmail.com</a><br>
</div><div><div class="h5">> <mailto:<a href="mailto:jljusten@gmail.com">jljusten@gmail.com</a>>> wrote:<br>
> >>> Also, perhaps we should log a spec bug to ask the spec to<br>
> clarify this?<br>
> >><br>
> >> IMHO, the intent is already clear from the fact that all the<br>
> >> redeclaration examples in the spec include the in/out qualifier. The<br>
> >> fact that the NVIDIA compiler sometimes misbehaves if in/out is<br>
> absent<br>
> >> seems like adequate confirmation to me. Spec bugs frequently<br>
> take weeks<br>
> >> or months to get resolved, so I guess I'm having trouble convincing<br>
> >> myself that it's worth it in this case.<br>
> >><br>
> >> Anyone else want to weigh in with an opinion on this? Idr?<br>
> ><br>
> > I think the spec is already clear, and NVIDIA's implementation is just<br>
> > buggy.<br>
><br>
> Arg... but let me be clear. It is already explicitly an error to do:<br>
><br>
> in vec4 foo;<br>
> vec4 foo;<br>
><br>
> or<br>
><br>
> vec4 foo;<br>
> centroid in vec4 foo;<br>
><br>
> or<br>
><br>
> in vec4 foo;<br>
> centroid in vec4 foo; // this one is okay.<br>
><br>
><br>
> Actually my reading of GLSL 1.50 is that only built-ins can be<br>
> redeclared for purposes of changing their interpolation qualifiers. So<br>
> I think this is illegal too. Does that change your opinion?<br>
<br>
</div></div>Maybe... I would have to dig around with the spec. Is there some<br>
specific text you had in mind?<br></blockquote><div><br>3.7 (Identifiers) says:<br><br>"However, as noted in the specification, there are some cases where previously declared variables can be redeclared to change or add some property, and predeclared "gl_" names are allowed to be redeclared in a shader only for these specific purposes. More generally, it is an error to redeclare a variable, including those starting "gl_"."<br>
<br>And the text that allows redeclaration to change interpolation qualifiers is in section 4.3.9.1 (Redeclaring Built-in Interpolation Variables in the Compatibility Profile). It begins:<br><br>"The following predeclared variables can be redeclared with an interpolation qualifier when using the compatibility profile:"<br>
<br>I can't find any text saying that non-built-in variables can be redeclared with an interpolation qualifier, so the text from 3.7 saying that it's an error to redeclare a variable seems like it applies.<br> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
If this is in fact the case, then NVIDIA may well be following the<br>
letter of the spec in the fragment shader. Redeclaring gl_ClipDistance<br>
without "in" makes it a plain global variable... that is never<br>
initialized, so reading results in garbage data. Lol.<br></blockquote><div><br></div><div>I suspect this is what the driver is doing, but I don't see any spec text indicating that it's ok. Changing an input into an ordinary global is definitely *not* one of the "specific purposes" that the spec outlines where redeclaration is allowed.<br>
<br></div><div>At the moment I'm fairly convinced that redeclaring gl_ClipDistance to remove "in" should be an error, and NVIDIA's compiler is just failing to detect the error condition and going off into the weeds. <br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class=""><div class="h5"><br>
> vec4 foo; // this one is not.<br>
><br>
> There is no reason to believe built-in variables should have a different<br>
> set of rules. Right?<br>
<br>
</div></div></blockquote></div><br></div></div>