[Piglit] [PATCH 2/2] glsl-1.50: Add copiler tests to verify gl_FragCoord layout qualifiers
Ian Romanick
idr at freedesktop.org
Mon Feb 10 18:42:29 PST 2014
I think you mean "compiler" in the subject. :)
On 02/10/2014 06:15 PM, Anuj Phogat wrote:
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
> .../layout-qualifiers-conflicting-case-1.frag | 37 ++++++++++++++++++++++
> .../layout-qualifiers-conflicting-case-2.frag | 37 ++++++++++++++++++++++
> .../layout-qualifiers-matching.frag | 37 ++++++++++++++++++++++
> 3 files changed, 111 insertions(+)
> create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-1.frag
> create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-2.frag
> create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-matching.frag
>
> diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-1.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-1.frag
> new file mode 100644
> index 0000000..d574e4f
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-1.frag
> @@ -0,0 +1,37 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.50
> + * check_link: false
> + * [end config]
> + */
> +
I would just combine these comments.
> +/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2 Fragment Shader
> + * Special Variables). The layout qualifier identifiers for
> + * gl_FragCoord are
> + *
> + * layout-qualifier-id:
> + * origin_upper_left
> + * pixel_center_integer"
> + *
> + * "If gl_FragCoord is redeclared in any fragment shader in a program,
> + * it must be redeclared in all the fragment shaders in that program
> + * that have a static use gl_FragCoord. All redeclarations of
> + * gl_FragCoord in all fragment shaders in a single program must have
> + * the same set of qualifiers."
Do later versions of the spec give any guidance about when these errors
should be generated? Somewhere in the 4.x series we started being
specific. Before that, it was ambiguous. Some implementations
generated the error at compile time, while others generated the error at
link time.
> + *
> + * Tests the conflicting redeclarations of gl_FragCoord within same fragment
> + * shader.
> + */
> +
> +#version 150
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +layout(origin_upper_left) in vec4 gl_FragCoord;
> +
> +void main()
> +{
> + gl_FragColor = gl_FragCoord.xyzz;
> +}
> diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-2.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-2.frag
> new file mode 100644
> index 0000000..eb8976c
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-2.frag
> @@ -0,0 +1,37 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.50
> + * check_link: false
> + * [end config]
> + */
> +
> +/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2 Fragment Shader
> + * Special Variables). The layout qualifier identifiers for
> + * gl_FragCoord are
> + *
> + * layout-qualifier-id:
> + * origin_upper_left
> + * pixel_center_integer"
> + *
> + * "If gl_FragCoord is redeclared in any fragment shader in a program,
> + * it must be redeclared in all the fragment shaders in that program
> + * that have a static use gl_FragCoord. All redeclarations of
> + * gl_FragCoord in all fragment shaders in a single program must have
> + * the same set of qualifiers."
> + *
> + * Tests the conflicting redeclarations in a fragment shader cause the compile
> + * failure even if gl_FragCoord is not used.
> + */
> +
> +#version 150
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +layout(origin_upper_left) in vec4 gl_FragCoord;
> +
> +void main()
> +{
> + gl_FragColor = vec4(1.0);
> +}
> diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-matching.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-matching.frag
> new file mode 100644
> index 0000000..63942cc
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-matching.frag
> @@ -0,0 +1,37 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.50
> + * check_link: false
> + * [end config]
> + */
> +
> +/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2 Fragment Shader
> + * Special Variables). The layout qualifier identifiers for
> + * gl_FragCoord are
> + *
> + * layout-qualifier-id:
> + * origin_upper_left
> + * pixel_center_integer"
> + *
> + * "If gl_FragCoord is redeclared in any fragment shader in a program,
> + * it must be redeclared in all the fragment shaders in that program
> + * that have a static use gl_FragCoord. All redeclarations of
> + * gl_FragCoord in all fragment shaders in a single program must have
> + * the same set of qualifiers."
> + *
> + * Tests the matching redeclarations of gl_FragCoord within same fragment
> + * shader.
> + */
> +
> +#version 150
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +
> +void main()
> +{
> + gl_FragColor = gl_FragCoord.xyzz;
> +}
>
More information about the Piglit
mailing list