[Piglit] [PATCH V6] arb_fragment_coord_conventions compiler/parser
Ian Romanick
idr at freedesktop.org
Fri Aug 16 10:49:44 PDT 2013
On 08/16/2013 10:09 AM, Steve Miller wrote:
> Compiler test for layout qualifiers and redeclaration of gl_FragCoord.
>
> v2 : typecast data to fragcolor as vec4 (was error in original)
> v3 : added entry to all.tests for compiler directory
> : compiler tests now require gl110 and extension. piglit passes
> v4 : comment consistency, quote change, frag swizzle
> v5 : renamed two tests for illegal usage -01-PointCoord and -02-FrontFacing
> : added test for redeclaration on vertex input
> : added test for redeclaration on uniform value in FS
> v6 : created user defined varying redeclaration test
I also just noticed the "Dependencies on ARB_fragment_program extension"
section of the spec. We'll need some follow-on tests for that... I
don't think this was ever implemented. :(
Anyway, these tests are
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> tests/all.tests | 3 ++
> .../basic-qualifiers-both-origin-and-pixel.frag | 31 +++++++++++++++++++
> ...ic-qualifiers-layout-illegal-01-PointCoord.frag | 33 ++++++++++++++++++++
> ...c-qualifiers-layout-illegal-02-FrontFacing.frag | 33 ++++++++++++++++++++
> .../compiler/basic-qualifiers-nothing.frag | 34 ++++++++++++++++++++
> .../compiler/basic-qualifiers-origin.frag | 31 +++++++++++++++++++
> .../compiler/basic-qualifiers-pixel-center.frag | 31 +++++++++++++++++++
> .../compiler/redeclaration-after-use.frag | 28 +++++++++++++++++
> .../compiler/redeclaration-outside-fs.vert | 36 ++++++++++++++++++++++
> ...redeclaration-qualifier-applied-to-uniform.frag | 34 ++++++++++++++++++++
> ...laration-qualifier-applied-to-vertex-input.vert | 34 ++++++++++++++++++++
> .../redeclaration-user-defined-varying.frag | 34 ++++++++++++++++++++
> 12 files changed, 362 insertions(+)
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-01-PointCoord.frag
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-02-FrontFacing.frag
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-uniform.frag
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-vertex-input.vert
> create mode 100644 tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-user-defined-varying.frag
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 8766572..8342911 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1093,6 +1093,9 @@ arb_fragment_coord_conventions = Group()
> spec['ARB_fragment_coord_conventions'] = arb_fragment_coord_conventions
> add_vpfpgeneric(arb_fragment_coord_conventions, 'fp-arb-fragment-coord-conventions-none')
> add_vpfpgeneric(arb_fragment_coord_conventions, 'fp-arb-fragment-coord-conventions-integer')
> +import_glsl_parser_tests(arb_fragment_coord_conventions,
> + os.path.join(testsDir, 'spec',
> + 'arb_fragment_coord_conventions'), ['compiler'])
>
> ati_fragment_shader = Group()
> spec['ATI_fragment_shader'] = ati_fragment_shader
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag
> new file mode 100644
> index 0000000..216da13
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag
> @@ -0,0 +1,31 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer"
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +
> +void main()
> +{
> + gl_FragColor = gl_FragCoord.xyzz;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-01-PointCoord.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-01-PointCoord.frag
> new file mode 100644
> index 0000000..b5358eb
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-01-PointCoord.frag
> @@ -0,0 +1,33 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer"
> + *
> + * Test should fail because input layout should only apply to gl_FragCoord.
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +layout(origin_upper_left, pixel_center_integer) in vec2 gl_PointCoord;
> +
> +void main()
> +{
> + gl_FragColor = gl_FragCoord.xyzz;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-02-FrontFacing.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-02-FrontFacing.frag
> new file mode 100644
> index 0000000..2e87c56
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal-02-FrontFacing.frag
> @@ -0,0 +1,33 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer
> + *
> + * Test should fail because input layout should only apply to gl_FragCoord.
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +layout(origin_upper_left, pixel_center_integer) in bool gl_FrontFacing;
> +
> +void main()
> +{
> + gl_FragColor = gl_FragCoord.xyzz;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag
> new file mode 100644
> index 0000000..4055dfe
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag
> @@ -0,0 +1,34 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer"
> + * ...
> + * Redeclarations are done as follows
> + * in vec4 gl_FragCoord; // redeclaration that changes nothing is allowed
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +in vec4 gl_FragCoord;
> +
> +void main()
> +{
> + gl_FragColor = gl_FragCoord.xyzz;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag
> new file mode 100644
> index 0000000..c09ca9b
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag
> @@ -0,0 +1,31 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer"
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +layout(origin_upper_left) in vec4 gl_FragCoord;
> +
> +void main()
> +{
> + gl_FragColor = gl_FragCoord.xyzz;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag
> new file mode 100644
> index 0000000..f7b1a37
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag
> @@ -0,0 +1,31 @@
> +/* [config]
> + * expect_result: pass
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer"
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +layout(pixel_center_integer) in vec4 gl_FragCoord;
> +
> +void main()
> +{
> + gl_FragColor = gl_FragCoord.xyzz;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag
> new file mode 100644
> index 0000000..f9e67c1
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag
> @@ -0,0 +1,28 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Within any shader, the first redeclarations of gl_FragCoord must appear
> + * before any use of gl_FragCoord."
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +vec2 a = gl_FragCoord.xy;
> +
> +in vec4 gl_FragCoord; //redeclaration after use should be illegal
> +
> +void main()
> +{
> + gl_FragColor = gl_FragCoord.xyzz;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert
> new file mode 100644
> index 0000000..9550db7
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert
> @@ -0,0 +1,36 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer"
> + *
> + * This test assumes that gl_FragCoord cannot be redeclared anywhere other than
> + * a fragment shader.
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +in vec4 vertex;
> +
> +in vec4 gl_FragCoord; //redeclaration in a VS
> +
> +void main()
> +{
> + gl_Position = vertex;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-uniform.frag b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-uniform.frag
> new file mode 100644
> index 0000000..08d3c22
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-uniform.frag
> @@ -0,0 +1,34 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer"
> + *
> + * This test assumes that gl_FragCoord layout qualifiers cannot be applied to
> + * uniform values.
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +layout(origin_upper_left, pixel_center_integer)uniform vec4 a;
> +
> +void main()
> +{
> + gl_FragColor = a.xyzw;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-vertex-input.vert b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-vertex-input.vert
> new file mode 100644
> index 0000000..d68f11e
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-qualifier-applied-to-vertex-input.vert
> @@ -0,0 +1,34 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer"
> + *
> + * This test assumes that gl_FragCoord layout qualifiers cannot be used anywhere
> + * other than a fragment shader.
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +layout(origin_upper_left) in vec4 vertex;
> +
> +void main()
> +{
> + gl_Position = vertex;
> +}
> diff --git a/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-user-defined-varying.frag b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-user-defined-varying.frag
> new file mode 100644
> index 0000000..8346f67
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-user-defined-varying.frag
> @@ -0,0 +1,34 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.10
> + * require_extensions: GL_ARB_fragment_coord_conventions
> + * check_link: false
> + * [end config]
> + */
> +
> +/*
> + * Section 4.3.x.1 (Input Layout Qualifiers) of the
> + * ARB_fragment_coord_conventions spec says:
> + *
> + * "Fragment shaders can have an input layout only for redeclaring the
> + * built-in variable gl_FragCoord (see section 7.2). The layout qualifier
> + * identifiers for gl_FragCoord are
> + *
> + * <layout-qualifier-id>
> + * origin_upper_left
> + * pixel_center_integer"
> + *
> + * This test assumes that gl_FragCoord layout qualifiers cannot be applied to
> + * user defined varyings.
> + */
> +
> +#version 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +layout(origin_upper_left, pixel_center_integer)in vec4 a;
> +
> +void main()
> +{
> + gl_FragColor = a.xyzw;
> +}
>
More information about the Piglit
mailing list