<div dir="ltr">On 23 October 2013 10:51, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</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="im">Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>> writes:<br>
<br>
> When a geometry shader is present, the fragment shader gl_PrimitiveID<br>
> input acts like an ordinary varying, receiving data from the gs<br>
> gl_PrimitiveID output.  When there's no geometry shader, we have to<br>
> ask the fixed function SF hardware to provide the primitive ID to the<br>
> fragment shader instead.<br>
><br>
> Previously, the SF setup code would handle this situation by<br>
> recognizing that the FS gl_PrimitiveID input didn't match to any VS<br>
> output; since normally an FS input with no corresponding VS output<br>
> leads to undefined data, the SF setup code used to just arbitrarily<br>
> assign it to receive data from attribute 0.<br>
><br>
> This patch changes the SF setup code so that instead of arbitrarily<br>
> using attribute 0, it assigns the unmatched FS input to receive<br>
> gl_PrimitiveID.  In the case where the FS input really is<br>
> gl_PrimitiveID, this produces the intended result.  In all other<br>
> cases, no harm is done since GL specifies that the behaviour is<br>
> undefined.<br>
><br>
> Fixes piglit test primitive-id-no-gs.<br>
<br>
</div>Reviewed-by: Eric Anholt <<a href="mailto:eric@anholt.net">eric@anholt.net</a>><br>
</blockquote></div><br></div><div class="gmail_extra">I was about to push this when I realized that it regressed point sprite functionality.  It seems that if an attribute has its "component override" bots set *and* its "point sprite texture coordinate enable" bit set, the component override takes predence (this isn't documented; I found it out by running piglit tests).  As a result, this patch was causing gl_PointCoord to get overridden with gl_PrimitiveID.<br>
<br>I'll follow up shortly with a corrected patch.<br></div></div>