[Piglit] [PATCH] gs: Test redeclaring either gl_PerVertex in or out, and using both.

Paul Berry stereotype441 at gmail.com
Mon Nov 11 14:58:06 PST 2013


On 6 November 2013 14:06, Ian Romanick <idr at freedesktop.org> wrote:

> On 10/15/2013 03:53 PM, Paul Berry wrote:
>
> This test is
>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>
> Do we already have tests that redeclare these blocks but try to use
> fields that were not in the redeclaration?
>

Yes:
- gs-redeclares-pervertex-in-before-other-usage.geom
- gs-redeclares-pervertex-out-before-other-usage.geom
- vs-redeclares-pervertex-out-before-other-usage.vert


>
> > ---
> >  .../gs-redeclares-pervertex-in-only.shader_test    | 55
> ++++++++++++++++++++++
> >  .../gs-redeclares-pervertex-out-only.shader_test   | 53
> +++++++++++++++++++++
> >  2 files changed, 108 insertions(+)
> >  create mode 100644
> tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test
> >  create mode 100644
> tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test
> >
> > diff --git
> a/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test
> b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test
> > new file mode 100644
> > index 0000000..f28bd7f
> > --- /dev/null
> > +++
> b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test
> > @@ -0,0 +1,55 @@
> > +# This test verifies that a geometry shader can redeclare just the
> > +# gl_PerVertex input block, but still use members of the gl_PerVertex
> > +# output block (whether or not those members were included in the
> > +# redeclaration of the input block).
> > +
> > +[require]
> > +GLSL >= 1.50
> > +
> > +[vertex shader]
> > +in vec4 piglit_vertex;
> > +out gl_PerVertex {
> > +  vec4 gl_Position;
> > +};
> > +
> > +void main()
> > +{
> > +  gl_Position = piglit_vertex;
> > +}
> > +
> > +[geometry shader]
> > +layout(triangles) in;
> > +layout(triangle_strip, max_vertices = 3) out;
> > +
> > +in gl_PerVertex {
> > +  vec4 gl_Position;
> > +} gl_in[];
> > +
> > +void main()
> > +{
> > +  for (int i = 0; i < 3; i++) {
> > +    gl_Position = gl_in[i].gl_Position;
> > +    gl_ClipDistance[0] = 1.0;
> > +    EmitVertex();
> > +  }
> > +}
> > +
> > +[fragment shader]
> > +void main()
> > +{
> > +  if (gl_ClipDistance[0] == 1.0)
> > +    gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
> > +  else
> > +    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
> > +}
> > +
> > +[test]
> > +# Since the fragment shader's gl_ClipDistance array is only defined
> > +# for elements that have clipping enabled, we need to enable clip
> > +# plane 0.  Fortunately the values we use for gl_ClipDistance are
> > +# always positive, so no pixels are actually clipped.
> > +enable GL_CLIP_PLANE0
> > +clear color 0.0 0.0 0.0 0.0
> > +clear
> > +draw rect -1 -1 2 2
> > +probe all rgba 0.0 1.0 0.0 1.0
> > diff --git
> a/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test
> b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test
> > new file mode 100644
> > index 0000000..e3f3dbd
> > --- /dev/null
> > +++
> b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test
> > @@ -0,0 +1,53 @@
> > +# This test verifies that a geometry shader can redeclare just the
> > +# gl_PerVertex output block, but still use members of the gl_PerVertex
> > +# input block (whether or not those members were included in the
> > +# redeclaration of the output block).
> > +
> > +[require]
> > +GLSL >= 1.50
> > +
> > +[vertex shader]
> > +in vec4 piglit_vertex;
> > +
> > +void main()
> > +{
> > +  gl_Position = piglit_vertex;
> > +  gl_PointSize = dot(piglit_vertex, vec4(1.0));
> > +}
> > +
> > +[geometry shader]
> > +layout(triangles) in;
> > +layout(triangle_strip, max_vertices = 3) out;
> > +
> > +out gl_PerVertex {
> > +  vec4 gl_Position;
> > +};
> > +out vec4 color;
> > +
> > +void main()
> > +{
> > +  bool ok = true;
> > +  for (int i = 0; i < 3; i++) {
> > +    if (gl_in[i].gl_PointSize != dot(gl_in[i].gl_Position, vec4(1.0)))
> > +      ok = false;
> > +  }
> > +  for (int i = 0; i < 3; i++) {
> > +    gl_Position = gl_in[i].gl_Position;
> > +    color = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> > +    EmitVertex();
> > +  }
> > +}
> > +
> > +[fragment shader]
> > +in vec4 color;
> > +
> > +void main()
> > +{
> > +  gl_FragColor = color;
> > +}
> > +
> > +[test]
> > +clear color 0.0 0.0 0.0 0.0
> > +clear
> > +draw rect -1 -1 2 2
> > +probe all rgba 0.0 1.0 0.0 1.0
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131111/0bc7c434/attachment.html>


More information about the Piglit mailing list