Re: [Piglit] [PATCH 06/14] Test that the built-in gl_PerVertex interface block can be redeclared.

2013-10-08 Thread Paul Berry
On 8 October 2013 11:40, Jordan Justen  wrote:

> On Wed, Oct 2, 2013 at 4:45 PM, Paul Berry 
> wrote:
> > ---
> >  .../redeclare-pervertex-out-subset-gs.shader_test  |  77 ++
> >  ...redeclare-pervertex-subset-vs-to-gs.shader_test | 113
> +
> >  .../redeclare-pervertex-subset-vs.shader_test  |  73 +
> >  3 files changed, 263 insertions(+)
> >  create mode 100644
> tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
> >  create mode 100644
> tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
> >  create mode 100644
> tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test
> >
> > diff --git
> a/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
> b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
> > new file mode 100644
> > index 000..baaa0f1
> > --- /dev/null
> > +++
> b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
> > @@ -0,0 +1,77 @@
> > +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10
> > +# spec:
> > +#
> > +#   The gl_PerVertex block can be redeclared in a shader to explicitly
> > +#   indicate what subset of the fixed pipeline interface will be
> > +#   used. This is necessary to establish the interface between multiple
> > +#   programs.  For example:
> > +#
> > +#   out gl_PerVertex {
> > +#   vec4 gl_Position;// will use gl_Position
> > +#   float gl_PointSize;  // will use gl_PointSize
> > +#   vec4 t;  // error, only gl_PerVertex members allowed
>
> Not a big deal, but the bad example of 't' here seems to be left over
> from patch 3's comment. I see it below again.
>

Since the example text is a literal quote from the spec, I think I'll leave
it as is, but I've added notes below it to clarify that in these particular
tests, we're not exercising the bad "vec4 t" case because we're testing
that gl_PerVertex functions properly when it's correctly redeclared.


>
> So far 1-6 Reviewed-by: Jordan Justen 
>

Thanks!


>
> -Jordan
>
> > +#   };  // no other members of gl_PerVertex will be used
> > +#
> > +#   This establishes the output interface the shader will use with the
> > +#   subsequent pipeline stage. It must be a subset of the built-in
> members
> > +#   of gl_PerVertex.
> > +#
> > +# This appears to be a clarification to the behaviour established for
> > +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version
> > +# 1.50.
> > +#
> > +# This test verifies that the geometry shader can redeclare gl_PerVertex
> > +# specifying a subset of the built-in values (gl_Position and
> > +# gl_PointSize), and the subset works.
> > +#
> > +# This test draws a small point in the left half of the window and a
> > +# large point in the right half.  Then it probes the region around
> > +# each point to ensure that the point on the right is larger.
> > +#
> > +# NOTE: since gl_PointSize is expressed in pixels, but gl_Position is
> > +# expressed relative to the window size, this test is dependent upon
> > +# the window size.  It assumes a window size of 250x250, which is the
> > +# shader_runner default.
> > +
> > +[require]
> > +GLSL >= 1.50
> > +
> > +[vertex shader]
> > +void main()
> > +{
> > +}
> > +
> > +[geometry shader]
> > +layout(points) in;
> > +layout(points, max_vertices = 2) out;
> > +
> > +out gl_PerVertex {
> > +vec4 gl_Position;
> > +float gl_PointSize;
> > +};
> > +
> > +void main()
> > +{
> > +  gl_Position = vec4(-0.5, 0.0, 0.0, 1.0);
> > +  gl_PointSize = 1.0;
> > +  EmitVertex();
> > +  gl_Position = vec4(0.5, 0.0, 0.0, 1.0);
> > +  gl_PointSize = 13.0;
> > +  EmitVertex();
> > +}
> > +
> > +[fragment shader]
> > +void main()
> > +{
> > +  gl_FragColor = vec4(1.0);
> > +}
> > +
> > +[test]
> > +clear color 0.0 0.0 0.0 0.0
> > +clear
> > +enable GL_PROGRAM_POINT_SIZE
> > +draw arrays GL_POINTS 0 1
> > +relative probe rgba (0.24, 0.5) (0.0, 0.0, 0.0, 0.0)
> > +relative probe rgba (0.26, 0.5) (0.0, 0.0, 0.0, 0.0)
> > +relative probe rgba (0.74, 0.5) (1.0, 1.0, 1.0, 1.0)
> > +relative probe rgba (0.76, 0.5) (1.0, 1.0, 1.0, 1.0)
> > diff --git
> a/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
> b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
> > new file mode 100644
> > index 000..7472762
> > --- /dev/null
> > +++
> b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
> > @@ -0,0 +1,113 @@
> > +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10
> > +# spec:
> > +#
> > +#   The gl_PerVertex block can be redeclared in a shader to explicitly
> > +#   indicate what subset of the fixed pipeline interface will be
> > +#   used. This is necessary to establish the interface between multiple
> > +#   programs.  For example:
> > +#
> > +#   out gl_PerVertex {
> > +#   vec4 gl_Position;// will use gl_Position
> >

Re: [Piglit] [PATCH 06/14] Test that the built-in gl_PerVertex interface block can be redeclared.

2013-10-08 Thread Jordan Justen
On Wed, Oct 2, 2013 at 4:45 PM, Paul Berry  wrote:
> ---
>  .../redeclare-pervertex-out-subset-gs.shader_test  |  77 ++
>  ...redeclare-pervertex-subset-vs-to-gs.shader_test | 113 
> +
>  .../redeclare-pervertex-subset-vs.shader_test  |  73 +
>  3 files changed, 263 insertions(+)
>  create mode 100644 
> tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
>  create mode 100644 
> tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
>  create mode 100644 
> tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test
>
> diff --git 
> a/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
>  
> b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
> new file mode 100644
> index 000..baaa0f1
> --- /dev/null
> +++ 
> b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
> @@ -0,0 +1,77 @@
> +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10
> +# spec:
> +#
> +#   The gl_PerVertex block can be redeclared in a shader to explicitly
> +#   indicate what subset of the fixed pipeline interface will be
> +#   used. This is necessary to establish the interface between multiple
> +#   programs.  For example:
> +#
> +#   out gl_PerVertex {
> +#   vec4 gl_Position;// will use gl_Position
> +#   float gl_PointSize;  // will use gl_PointSize
> +#   vec4 t;  // error, only gl_PerVertex members allowed

Not a big deal, but the bad example of 't' here seems to be left over
from patch 3's comment. I see it below again.

So far 1-6 Reviewed-by: Jordan Justen 

-Jordan

> +#   };  // no other members of gl_PerVertex will be used
> +#
> +#   This establishes the output interface the shader will use with the
> +#   subsequent pipeline stage. It must be a subset of the built-in members
> +#   of gl_PerVertex.
> +#
> +# This appears to be a clarification to the behaviour established for
> +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version
> +# 1.50.
> +#
> +# This test verifies that the geometry shader can redeclare gl_PerVertex
> +# specifying a subset of the built-in values (gl_Position and
> +# gl_PointSize), and the subset works.
> +#
> +# This test draws a small point in the left half of the window and a
> +# large point in the right half.  Then it probes the region around
> +# each point to ensure that the point on the right is larger.
> +#
> +# NOTE: since gl_PointSize is expressed in pixels, but gl_Position is
> +# expressed relative to the window size, this test is dependent upon
> +# the window size.  It assumes a window size of 250x250, which is the
> +# shader_runner default.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +void main()
> +{
> +}
> +
> +[geometry shader]
> +layout(points) in;
> +layout(points, max_vertices = 2) out;
> +
> +out gl_PerVertex {
> +vec4 gl_Position;
> +float gl_PointSize;
> +};
> +
> +void main()
> +{
> +  gl_Position = vec4(-0.5, 0.0, 0.0, 1.0);
> +  gl_PointSize = 1.0;
> +  EmitVertex();
> +  gl_Position = vec4(0.5, 0.0, 0.0, 1.0);
> +  gl_PointSize = 13.0;
> +  EmitVertex();
> +}
> +
> +[fragment shader]
> +void main()
> +{
> +  gl_FragColor = vec4(1.0);
> +}
> +
> +[test]
> +clear color 0.0 0.0 0.0 0.0
> +clear
> +enable GL_PROGRAM_POINT_SIZE
> +draw arrays GL_POINTS 0 1
> +relative probe rgba (0.24, 0.5) (0.0, 0.0, 0.0, 0.0)
> +relative probe rgba (0.26, 0.5) (0.0, 0.0, 0.0, 0.0)
> +relative probe rgba (0.74, 0.5) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.76, 0.5) (1.0, 1.0, 1.0, 1.0)
> diff --git 
> a/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
>  
> b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
> new file mode 100644
> index 000..7472762
> --- /dev/null
> +++ 
> b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
> @@ -0,0 +1,113 @@
> +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10
> +# spec:
> +#
> +#   The gl_PerVertex block can be redeclared in a shader to explicitly
> +#   indicate what subset of the fixed pipeline interface will be
> +#   used. This is necessary to establish the interface between multiple
> +#   programs.  For example:
> +#
> +#   out gl_PerVertex {
> +#   vec4 gl_Position;// will use gl_Position
> +#   float gl_PointSize;  // will use gl_PointSize
> +#   vec4 t;  // error, only gl_PerVertex members allowed
> +#   };  // no other members of gl_PerVertex will be used
> +#
> +#   This establishes the output interface the shader will use with the
> +#   subsequent pipeline stage. It must be a subset of the built-in members
> +#   of gl_PerVertex.
> +#
> +# Furthermore, section 7.1.1 (Compatibility Profile Built-In Language
> +# Variables) says:
> +#
> +#   In the tessellation control, evaluation, and geometry shaders, the
> +#   outputs of the previ

[Piglit] [PATCH 06/14] Test that the built-in gl_PerVertex interface block can be redeclared.

2013-10-02 Thread Paul Berry
---
 .../redeclare-pervertex-out-subset-gs.shader_test  |  77 ++
 ...redeclare-pervertex-subset-vs-to-gs.shader_test | 113 +
 .../redeclare-pervertex-subset-vs.shader_test  |  73 +
 3 files changed, 263 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
 create mode 100644 
tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test

diff --git 
a/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test 
b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
new file mode 100644
index 000..baaa0f1
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test
@@ -0,0 +1,77 @@
+# From section 7.1 (Built-In Language Variables) of the GLSL 4.10
+# spec:
+#
+#   The gl_PerVertex block can be redeclared in a shader to explicitly
+#   indicate what subset of the fixed pipeline interface will be
+#   used. This is necessary to establish the interface between multiple
+#   programs.  For example:
+#
+#   out gl_PerVertex {
+#   vec4 gl_Position;// will use gl_Position
+#   float gl_PointSize;  // will use gl_PointSize
+#   vec4 t;  // error, only gl_PerVertex members allowed
+#   };  // no other members of gl_PerVertex will be used
+#
+#   This establishes the output interface the shader will use with the
+#   subsequent pipeline stage. It must be a subset of the built-in members
+#   of gl_PerVertex.
+#
+# This appears to be a clarification to the behaviour established for
+# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version
+# 1.50.
+#
+# This test verifies that the geometry shader can redeclare gl_PerVertex
+# specifying a subset of the built-in values (gl_Position and
+# gl_PointSize), and the subset works.
+#
+# This test draws a small point in the left half of the window and a
+# large point in the right half.  Then it probes the region around
+# each point to ensure that the point on the right is larger.
+#
+# NOTE: since gl_PointSize is expressed in pixels, but gl_Position is
+# expressed relative to the window size, this test is dependent upon
+# the window size.  It assumes a window size of 250x250, which is the
+# shader_runner default.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+void main()
+{
+}
+
+[geometry shader]
+layout(points) in;
+layout(points, max_vertices = 2) out;
+
+out gl_PerVertex {
+vec4 gl_Position;
+float gl_PointSize;
+};
+
+void main()
+{
+  gl_Position = vec4(-0.5, 0.0, 0.0, 1.0);
+  gl_PointSize = 1.0;
+  EmitVertex();
+  gl_Position = vec4(0.5, 0.0, 0.0, 1.0);
+  gl_PointSize = 13.0;
+  EmitVertex();
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = vec4(1.0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+enable GL_PROGRAM_POINT_SIZE
+draw arrays GL_POINTS 0 1
+relative probe rgba (0.24, 0.5) (0.0, 0.0, 0.0, 0.0)
+relative probe rgba (0.26, 0.5) (0.0, 0.0, 0.0, 0.0)
+relative probe rgba (0.74, 0.5) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.76, 0.5) (1.0, 1.0, 1.0, 1.0)
diff --git 
a/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
 
b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
new file mode 100644
index 000..7472762
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test
@@ -0,0 +1,113 @@
+# From section 7.1 (Built-In Language Variables) of the GLSL 4.10
+# spec:
+#
+#   The gl_PerVertex block can be redeclared in a shader to explicitly
+#   indicate what subset of the fixed pipeline interface will be
+#   used. This is necessary to establish the interface between multiple
+#   programs.  For example:
+#
+#   out gl_PerVertex {
+#   vec4 gl_Position;// will use gl_Position
+#   float gl_PointSize;  // will use gl_PointSize
+#   vec4 t;  // error, only gl_PerVertex members allowed
+#   };  // no other members of gl_PerVertex will be used
+#
+#   This establishes the output interface the shader will use with the
+#   subsequent pipeline stage. It must be a subset of the built-in members
+#   of gl_PerVertex.
+#
+# Furthermore, section 7.1.1 (Compatibility Profile Built-In Language
+# Variables) says:
+#
+#   In the tessellation control, evaluation, and geometry shaders, the
+#   outputs of the previous stage described above are also available
+#   in the input gl_PerVertex block in these languages.
+#
+#   ...
+#
+#   These can be redeclared to establish an explicit pipeline
+#   interface, the same way as described above for the output block
+#   gl_PerVertex, and the input redeclaration must match the output
+#   redeclaration of the previous stage. However, when a built-in
+#   interface block with an instance name is redeclared (e.g., gl_in),
+#   the instance name must