[Piglit] [PATCH 2/2] Verify that built-in shader inputs are read-only.

Ian Romanick idr at freedesktop.org
Mon Nov 14 12:29:12 PST 2011


On 11/11/2011 03:22 PM, Paul Berry wrote:
> On 10 November 2011 15:47, Chad Versace <chad.versace at linux.intel.com
> <mailto:chad.versace at linux.intel.com>> wrote:
>
>     On 11/10/2011 11:38 AM, Paul Berry wrote:
>      > These tests verify that the following built-in shader input variables
>      > are read-only:
>      >
>      > For vertex shaders:
>      > - gl_Color
>      > - gl_SecondaryColor
>      > - gl_Normal
>      > - gl_Vertex
>      > - gl_MultiTexCoord0
>      > - gl_MultiTexCoord1
>      > - gl_MultiTexCoord2
>      > - gl_MultiTexCoord3
>      > - gl_MultiTexCoord4
>      > - gl_MultiTexCoord5
>      > - gl_MultiTexCoord6
>      > - gl_MultiTexCoord7
>      > - gl_FogCoord
>      > - gl_VertexID (a GLSL 1.30 feature)
>      >
>      > For fragment shaders:
>      > - gl_FragCoord
>      > - gl_FrontFacing
>      > - gl_ClipDistance (a GLSL 1.30 feature)
>      > ---
>      >  .../storage-qualfiers/static-write-color.vert      |   22
>     ++++++++++++++++++++
>      >  .../storage-qualfiers/static-write-fog-coord.vert  |   22
>     ++++++++++++++++++++
>      >  .../storage-qualfiers/static-write-frag-coord.frag |   14
>     ++++++++++++
>      >  .../static-write-front-facing.frag                 |   14
>     ++++++++++++
>      >  .../static-write-multitexcoord0.vert               |   22
>     ++++++++++++++++++++
>      >  .../static-write-multitexcoord1.vert               |   22
>     ++++++++++++++++++++
>      >  .../static-write-multitexcoord2.vert               |   22
>     ++++++++++++++++++++
>      >  .../static-write-multitexcoord3.vert               |   22
>     ++++++++++++++++++++
>      >  .../static-write-multitexcoord4.vert               |   22
>     ++++++++++++++++++++
>      >  .../static-write-multitexcoord5.vert               |   22
>     ++++++++++++++++++++
>      >  .../static-write-multitexcoord6.vert               |   22
>     ++++++++++++++++++++
>      >  .../static-write-multitexcoord7.vert               |   22
>     ++++++++++++++++++++
>      >  .../storage-qualfiers/static-write-normal.vert     |   22
>     ++++++++++++++++++++
>      >  .../static-write-secondary-color.vert              |   22
>     ++++++++++++++++++++
>      >  .../storage-qualfiers/static-write-vertex.vert     |   22
>     ++++++++++++++++++++
>      >  .../static-write-clip-distance.frag                |   20
>     ++++++++++++++++++
>      >  .../storage-qualifiers/static-write-in-direct.vert |   18
>     ++++++++++++++++
>      >  .../static-write-in-indirect.vert                  |   21
>     +++++++++++++++++++
>      >  .../storage-qualifiers/static-write-vertex-id.vert |   20
>     ++++++++++++++++++
>
>     All the tests look good, but I have two comments.
>
>     Along with gl_Color and gl_SecondaryColor, we should test
>     gl_BackColor and gl_BackSecondaryColor too.
>
>
> You're probably thinking of vertex shader outputs.  I'm testing vertex
> shader inputs, and for vertex shader inputs only gl_Color and
> gl_SecondaryColor exist.  (I know, weird, huh?)

(Ignore this comment if my sarcasm filter has failed.)

It's not weird at all.  Applications specify primary and secondary 
colors per-vertex.  It's not until much later in the pipeline that the 
polygon facing is known.  The vertex shader can take the input colors 
and generate potentially different primary and secondary colors for each 
facing case.  Fixed-function hardware between the geometry shader and 
the fragment shader picks one of those colors to route to the fragment 
shader.

> However, your comment reminds me that I left out some fragment shader
> inputs: gl_Color, gl_SecondaryColor, gl_TexCoord, gl_FogFragCoord, and
> gl_PointCoord.  I'll add those.
>
>
>     Tests static-write-in-indirect and static-write-in-direct fall
>     outside of the commit's subject. The commit
>     message should be updated to mention them or they should be placed
>     in a separate patch.
>
>
> You're right of course.  That will teach me to write code during a meeting.
>
> I'll send out a pair of patches to take the place of this one.


More information about the Piglit mailing list