[Piglit] [PATCH 1/2] glsl-1.50: Add shader tests to verify gl_FragCoord layout qualifiers

Ian Romanick idr at freedesktop.org
Mon Feb 10 18:45:15 PST 2014


This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

I sent some comments / questions on the other.

On 02/10/2014 06:15 PM, Anuj Phogat wrote:
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  ...ayout-qualifiers-conflicting-case-1.shader_test | 47 +++++++++++++++++
>  ...ayout-qualifiers-conflicting-case-2.shader_test | 59 +++++++++++++++++++++
>  ...ayout-qualifiers-conflicting-case-3.shader_test | 58 +++++++++++++++++++++
>  ...ayout-qualifiers-conflicting-case-4.shader_test | 57 ++++++++++++++++++++
>  ...d-layout-qualifiers-matching-case-1.shader_test | 58 +++++++++++++++++++++
>  ...d-layout-qualifiers-matching-case-2.shader_test | 59 +++++++++++++++++++++
>  ...d-layout-qualifiers-matching-case-3.shader_test | 60 ++++++++++++++++++++++
>  ...d-layout-qualifiers-matching-case-4.shader_test | 58 +++++++++++++++++++++
>  ...fragcoord-layout-qualifiers-missing.shader_test | 45 ++++++++++++++++
>  9 files changed, 501 insertions(+)
>  create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-1.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-4.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-1.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-3.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-4.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-missing.shader_test
> 
> diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-1.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-1.shader_test
> new file mode 100644
> index 0000000..7d0f10d
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-1.shader_test
> @@ -0,0 +1,47 @@
> +/* 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 case when all the fragment shaders redeclare gl_FragCoord
> + * but with conflicting layout qualifiers.
> + */
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +
> +void foo();
> +void main()
> +{
> +     gl_FragColor = vec4(gl_FragCoord.xyz, 1.0);
> +     foo();
> +}
> +
> +[fragment shader]
> +
> +layout(origin_upper_left) in vec4 gl_FragCoord;
> +void foo()
> +{
> +     gl_FragColor.a = gl_FragCoord.z;
> +}
> +
> +[test]
> +link error
> diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test
> new file mode 100644
> index 0000000..ad15c48
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test
> @@ -0,0 +1,59 @@
> +/* 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 case when all the fragment shaders which use gl_FragCoord,
> + * redeclare it with conflicting layout qualifiers. It varifies that
> + * link error is not effected by the presence of a fragment shader which
> + * doesn't use gl_FragCoord.
> + */
> +[require]
> +GLSL >= 1.50
> +
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +void alpha();
> +void blue();
> +void main()
> +{
> +     gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
> +     blue();
> +     alpha();
> +}
> +
> +[fragment shader]
> +
> +void blue()
> +{
> +     gl_FragColor.b = 1.0;
> +}
> +
> +[fragment shader]
> +
> +layout(pixel_center_integer) in vec4 gl_FragCoord;
> +void alpha()
> +{
> +     gl_FragColor.a = gl_FragCoord.z;
> +}
> +
> +
> +[test]
> +link error
> diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test
> new file mode 100644
> index 0000000..73cc60b
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test
> @@ -0,0 +1,58 @@
> +/* 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 case when all the fragment shaders which use gl_FragCoord,
> + * redeclare it with conflicting layout qualifiers. It varifies that
> + * link error is generated even if gl_FragCoord is redeclared by the
> + * last fragment shader attached.
> + */
> +[require]
> +GLSL >= 1.50
> +
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +void alpha();
> +void blue();
> +void main()
> +{
> +     gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
> +     blue();
> +     alpha();
> +}
> +
> +[fragment shader]
> +
> +void blue()
> +{
> +     gl_FragColor.b = 1.0;
> +}
> +
> +[fragment shader]
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +void alpha()
> +{
> +     gl_FragColor.a = gl_FragCoord.z;
> +}
> +
> +
> +[test]
> +link error
> diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-4.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-4.shader_test
> new file mode 100644
> index 0000000..101cc3e
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-4.shader_test
> @@ -0,0 +1,57 @@
> +/* 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 case when only the fragment shaders which don't use gl_FragCoord,
> + * redeclare it. GLSL 1.50 expects the redeclaration to be present in all
> + * fragment shaders that use gl_FragCoord.
> + */
> +[require]
> +GLSL >= 1.50
> +
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +void alpha();
> +void blue();
> +void main()
> +{
> +     gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
> +     blue();
> +     alpha();
> +}
> +
> +[fragment shader]
> +
> +layout(pixel_center_integer) in vec4 gl_FragCoord;
> +void blue()
> +{
> +     gl_FragColor.b = 1.0;
> +}
> +
> +[fragment shader]
> +
> +void alpha()
> +{
> +     gl_FragColor.a = gl_FragCoord.z;
> +}
> +
> +
> +[test]
> +link error
> diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-1.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-1.shader_test
> new file mode 100644
> index 0000000..7b00f8e
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-1.shader_test
> @@ -0,0 +1,58 @@
> +/* 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 case when all the fragment shaders which use gl_FragCoord,
> + * redeclare it with matching layout qualifiers.
> + */
> +[require]
> +GLSL >= 1.50
> +
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +void alpha();
> +void blue();
> +void main()
> +{
> +     gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
> +     blue();
> +     alpha();
> +}
> +
> +[fragment shader]
> +
> +void blue()
> +{
> +     gl_FragColor.b = 1.0;
> +}
> +
> +[fragment shader]
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +void alpha()
> +{
> +     gl_FragColor.a = gl_FragCoord.z;
> +}
> +
> +
> +[test]
> +link success
> diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test
> new file mode 100644
> index 0000000..5212f8e
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test
> @@ -0,0 +1,59 @@
> +/* 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 case when all the fragment shaders which use gl_FragCoord,
> + * redeclare it with matching layout qualifiers. The specfic order of
> + * attached fragment shaders is important here.
> + */
> +[require]
> +GLSL >= 1.50
> +
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +void blue()
> +{
> +     gl_FragColor.b = 1.0;
> +}
> +
> +[fragment shader]
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +void alpha();
> +void blue();
> +void main()
> +{
> +     gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
> +     blue();
> +     alpha();
> +}
> +
> +[fragment shader]
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +void alpha()
> +{
> +     gl_FragColor.a = gl_FragCoord.z;
> +}
> +
> +
> +[test]
> +link success
> diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-3.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-3.shader_test
> new file mode 100644
> index 0000000..fd839b4
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-3.shader_test
> @@ -0,0 +1,60 @@
> +/* 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 case when all the fragment shaders redeclare gl_FragCoord with
> + * matching layout qualifiers. It also tests that redeclaring gl_FragCoord
> + * in a shader which doesn't use it, causes no link error.
> + */
> +[require]
> +GLSL >= 1.50
> +
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +layout(origin_upper_left) in vec4 gl_FragCoord;
> +void alpha();
> +void blue();
> +void main()
> +{
> +     gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
> +     blue();
> +     alpha();
> +}
> +
> +[fragment shader]
> +layout(origin_upper_left) in vec4 gl_FragCoord;
> +
> +void blue()
> +{
> +     gl_FragColor.b = 1.0;
> +}
> +
> +[fragment shader]
> +
> +layout(origin_upper_left) in vec4 gl_FragCoord;
> +void alpha()
> +{
> +     gl_FragColor.a = gl_FragCoord.z;
> +}
> +
> +
> +[test]
> +link success
> diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-4.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-4.shader_test
> new file mode 100644
> index 0000000..7a958de
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-4.shader_test
> @@ -0,0 +1,58 @@
> +/* 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 case when only one of the fragment shaders which don't use
> + * gl_FragCoord, redeclare it. Specific order of fragment shaders is
> + * important here.
> + */
> +[require]
> +GLSL >= 1.50
> +
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +
> +void alpha();
> +void blue();
> +void main()
> +{
> +     gl_FragColor = vec4(0.0);
> +     blue();
> +     alpha();
> +}
> +
> +[fragment shader]
> +
> +layout(pixel_center_integer) in vec4 gl_FragCoord;
> +void blue()
> +{
> +     gl_FragColor.b = 1.0;
> +}
> +
> +[fragment shader]
> +
> +layout(pixel_center_integer) in vec4 gl_FragCoord;
> +void alpha()
> +{
> +     gl_FragColor.a = gl_FragCoord.z;
> +}
> +
> +
> +[test]
> +link success
> diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-missing.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-missing.shader_test
> new file mode 100644
> index 0000000..058ca39
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-missing.shader_test
> @@ -0,0 +1,45 @@
> +/* 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 case when one of the fragment shader redeclares gl_FragCoord
> + * and other doesn't.
> + */
> +[require]
> +GLSL >= 1.50
> +
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +
> +void foo();
> +void main()
> +{
> +     gl_FragColor = vec4(gl_FragCoord.xyz, 1.0);
> +     foo();
> +}
> +
> +[fragment shader]
> +void foo()
> +{
> +     gl_FragColor.a = gl_FragCoord.z;
> +}
> +
> +[test]
> +link error
> 



More information about the Piglit mailing list