[Mesa-dev] [PATCH] i965: Make fs gl_PrimitiveID input work even when there's no gs.

Paul Berry stereotype441 at gmail.com
Fri Oct 25 14:54:25 CEST 2013


On 23 October 2013 10:51, Eric Anholt <eric at anholt.net> wrote:

> Paul Berry <stereotype441 at gmail.com> writes:
>
> > When a geometry shader is present, the fragment shader gl_PrimitiveID
> > input acts like an ordinary varying, receiving data from the gs
> > gl_PrimitiveID output.  When there's no geometry shader, we have to
> > ask the fixed function SF hardware to provide the primitive ID to the
> > fragment shader instead.
> >
> > Previously, the SF setup code would handle this situation by
> > recognizing that the FS gl_PrimitiveID input didn't match to any VS
> > output; since normally an FS input with no corresponding VS output
> > leads to undefined data, the SF setup code used to just arbitrarily
> > assign it to receive data from attribute 0.
> >
> > This patch changes the SF setup code so that instead of arbitrarily
> > using attribute 0, it assigns the unmatched FS input to receive
> > gl_PrimitiveID.  In the case where the FS input really is
> > gl_PrimitiveID, this produces the intended result.  In all other
> > cases, no harm is done since GL specifies that the behaviour is
> > undefined.
> >
> > Fixes piglit test primitive-id-no-gs.
>
> Reviewed-by: Eric Anholt <eric at anholt.net>
>

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.

I'll follow up shortly with a corrected patch.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131025/8670ac4a/attachment.html>


More information about the mesa-dev mailing list