[Piglit] [PATCH 2/3] GLSL 1.50: Test that differently specified input/output layouts results in link error

Paul Berry stereotype441 at gmail.com
Mon Aug 26 11:49:05 PDT 2013


On 23 August 2013 15:13, Nicholas Mack <nichmack at gmail.com> wrote:

> ---
>  ...ax-vertices-multiple-shader-objects.shader_test | 64
> ++++++++++++++++++++++
>  ...output-type-multiple-shader-objects.shader_test | 64
> ++++++++++++++++++++++
>  2 files changed, 128 insertions(+)
>  create mode 100644
> tests/spec/glsl-1.50/linker/gs-same-max-vertices-multiple-shader-objects.shader_test
>  create mode 100644
> tests/spec/glsl-1.50/linker/gs-same-output-type-multiple-shader-objects.shader_test
>
> diff --git
> a/tests/spec/glsl-1.50/linker/gs-same-max-vertices-multiple-shader-objects.shader_test
> b/tests/spec/glsl-1.50/linker/gs-same-max-vertices-multiple-shader-objects.shader_test
> new file mode 100644
> index 0000000..414629f
> --- /dev/null
> +++
> b/tests/spec/glsl-1.50/linker/gs-same-max-vertices-multiple-shader-objects.shader_test
>

The name is a little surprising since the test exercises two shaders that
have *different* values of max_vertices.  I'd rename it to
"gs-different-max-vertices-multiple-shader-objects.shader_test".


> @@ -0,0 +1,64 @@
> +# Section 2.11.2 (Program Objects) of the GLSL 1.50 spec says:
> +#
> +# "Linking will also fail if the program object contains objects to form a
> +#  geometry shader (see section 2.12), and
> +#      • the program contains no objects to form a vertex shader;
> +#      • the input primitive type, output primitive type, or maximum
> output
> +#        vertex count is not specified in any compiled geometry shader
> object;
> +#      • the input primitive type, output primitive type, or maximum
> output
> +#        vertex count is specified differently in multiple geometry shader
> +#        objects."
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +
> +in vec4 vertex;
> +out vec4 vertex_to_gs;
> +
> +void main()
> +{
> +  vertex_to_gs = vertex;
> +}
> +
> +[geometry shader]
> +#version 150
> +
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +
> +void do_vertex(int i);
> +
> +void main()
> +{
> +  for (int i = 0; i < 2; i++)
> +    do_vertex(i);
> +}
> +
> +[geometry shader]
> +#version 150
> +
> +layout(max_vertices = 2) out;
> +
> +in vec4 vertex_to_gs[2];
>

This needs to be "in vec4 vertex_to_gs[3];", otherwise the link will fail
for a reason unrelated to what you are trying to test.


> +
> +void do_vertex(int i)
> +{
> +  gl_Position = vertex_to_gs[i];
> +  EmitVertex();
> +}
> +
> +[fragment shader]
> +#version 150
> +
> +out vec4 color;
> +
> +void main()
> +{
> +  color = vec4(0.0, 1.0, 0.0, 1.0);
> +}
> +
> +[test]
> +link error
> diff --git
> a/tests/spec/glsl-1.50/linker/gs-same-output-type-multiple-shader-objects.shader_test
> b/tests/spec/glsl-1.50/linker/gs-same-output-type-multiple-shader-objects.shader_test
>

Similar comment on the name of tihs test.


> new file mode 100644
> index 0000000..4a35770
> --- /dev/null
> +++
> b/tests/spec/glsl-1.50/linker/gs-same-output-type-multiple-shader-objects.shader_test
> @@ -0,0 +1,64 @@
> +# Section 2.11.2 (Program Objects) of the GLSL 1.50 spec says:
> +#
> +# "Linking will also fail if the program object contains objects to form a
> +#  geometry shader (see section 2.12), and
> +#      • the program contains no objects to form a vertex shader;
> +#      • the input primitive type, output primitive type, or maximum
> output
> +#        vertex count is not specified in any compiled geometry shader
> object;
> +#      • the input primitive type, output primitive type, or maximum
> output
> +#        vertex count is specified differently in multiple geometry shader
> +#        objects."
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150
> +
> +in vec4 vertex;
> +out vec4 vertex_to_gs;
> +
> +void main()
> +{
> +  vertex_to_gs = vertex;
> +}
> +
> +[geometry shader]
> +#version 150
> +
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +
> +void do_vertex(int i);
> +
> +void main()
> +{
> +  for (int i = 0; i < 2; i++)
> +    do_vertex(i);
> +}
> +
> +[geometry shader]
> +#version 150
> +
> +layout(points) out;
> +
> +in vec4 vertex_to_gs[1];
>

As with the other test, this needs to be "in vec4 vertex_to_gs[3];".

With those changes, this patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


> +
> +void do_vertex(int i)
> +{
> +  gl_Position = vertex_to_gs[i];
> +  EmitVertex();
> +}
> +
> +[fragment shader]
> +#version 150
> +
> +out vec4 color;
> +
> +void main()
> +{
> +  color = vec4(0.0, 1.0, 0.0, 1.0);
> +}
> +
> +[test]
> +link error
> --
> 1.8.3.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130826/ad1ef20b/attachment.html>


More information about the Piglit mailing list