[Piglit] [PATCH] arb_fragment_coord_conventions compiler/parser

Paul Berry stereotype441 at gmail.com
Tue Aug 6 11:12:03 PDT 2013


On 1 August 2013 13:37, Steve Miller <dervishx at gmail.com> wrote:

> Tests for layout qualifiers and redeclaration of gl_FragCoord. Tests fail
> at this time due to compiler not supporting 3.2 FS input redeclarations.
>
> v2 commit : typecast data to fragcolor as vec4 (was error in original)
>

The commit subject sounds a little incomplete.  How about
"arb_fragment_coord_conventions: compiler/parser tests."?


> ---
>  .../basic-qualifiers-both-origin-and-pixel.frag    | 26
> ++++++++++++++++++++
>  .../compiler/basic-qualifiers-layout-illegal.frag  | 28
> ++++++++++++++++++++++
>  .../compiler/basic-qualifiers-nothing.frag         | 24
> +++++++++++++++++++
>  .../compiler/basic-qualifiers-origin.frag          | 25
> +++++++++++++++++++
>  .../compiler/basic-qualifiers-pixel-center.frag    | 25
> +++++++++++++++++++
>  .../compiler/redeclaration-after-use.frag          | 22 +++++++++++++++++
>  .../compiler/redeclaration-outside-fs.vert         | 26
> ++++++++++++++++++++
>  7 files changed, 176 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.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
>

Since this is a brand new folder you're creating, you need to make sure it
gets picked up by all.tests, e.g. by doing something like this:

import_glsl_parser_tests(arb_fragment_coord_conventions,
                         os.path.join(testsDir, 'spec',
'arb_fragment_coord_conventions'),
                         ['compiler'])

>
>
> 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..8632b64
> --- /dev/null
> +++
> b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag
> @@ -0,0 +1,26 @@
> +// [config]
> +// expect result: pass
>

This needs to say "expect_result" (note underscore) or it won't be parsed
correctly by the piglit framework, and the test won't run.  The same fix
needs to be made to the other tests in this patch as well.

In general, before submitting piglit patches, I'd recommend running them
using piglit-run.py (using the "-t" option so that you don't have to run
the entire test suite).  That will catch problems like these two.



> +// glsl_version: 1.50
>

Since these tests are in the arb_fragment_coord_conventions folder, they
should do their testing using the extension rather than GLSL 1.50.  I'd
recommend using a GLSL version of 110, since I don't believe your tests
rely on any features from later GLSL versions.

That means that in addition to changing the above line to "// glsl_version:
1.50", you'll have to add the line "// require_extensions:
GL_ARB_fragment_coord_conventions".


> +// 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
> +*
> +*/
> +
> +#version 150
> +
> +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> +
> +void main() {
> +
> +     gl_FragColor = vec4 (gl_FragCoord.x, gl_FragCoord.y,
> +                        gl_FragCoord.z, gl_FragCoord.z);
> +
> +}
> diff --git
> a/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal.frag
> b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal.frag
> new file mode 100644
> index 0000000..70208f4
> --- /dev/null
> +++
> b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal.frag
> @@ -0,0 +1,28 @@
> +// [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
> +*
> +* Test should fail because input layout should only apply to gl_FragCoord.
> +*/
> +
> +#version 150
> +
> +layout(origin_upper_left, pixel_center_integer) in vec2 gl_PointCoord;
> +
> +layout(origin_upper_left, pixel_center_integer) in bool gl_FrontFacing;
> +
> +void main() {
> +
> +     gl_FragColor = vec4 (gl_FragCoord.x, gl_FragCoord.y,
> +                        gl_FragCoord.z, gl_FragCoord.z);
> +}
> 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..9f6d8d5
> --- /dev/null
> +++
> b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag
> @@ -0,0 +1,24 @@
> +// [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).
> +*
> +*  Redeclarations are done as follows
> +*      in vec4 gl_FragCoord; // redeclaration that changes nothing is
> allowed
> +*/
> +
> +#version 150
> +
> +in vec4 gl_FragCoord;
> +
> +void main() {
> +
> +     gl_FragColor = vec4 (gl_FragCoord.x, gl_FragCoord.y,
> +                        gl_FragCoord.z, gl_FragCoord.z);
> +}
> 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..4787860
> --- /dev/null
> +++
> b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag
> @@ -0,0 +1,25 @@
> +// [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
> +*
> +*/
> +
> +#version 150
> +
> +layout(origin_upper_left) in vec4 gl_FragCoord;
> +
> +void main() {
> +
> +     gl_FragColor = vec4 (gl_FragCoord.x, gl_FragCoord.y,
> +                        gl_FragCoord.z, gl_FragCoord.z);
> +}
> 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..024de4f
> --- /dev/null
> +++
> b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag
> @@ -0,0 +1,25 @@
> +// [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
> +*
> +*/
> +
> +#version 150
> +
> +layout(pixel_center_integer) in vec4 gl_FragCoord;
> +
> +void main() {
> +
> +     gl_FragColor = vec4 (gl_FragCoord.x, gl_FragCoord.y,
> +                        gl_FragCoord.z, gl_FragCoord.z);
> +}
> 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..b572563
> --- /dev/null
> +++
> b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag
> @@ -0,0 +1,22 @@
> +// [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:
> +*  Within any shader, the first redeclarations of gl_FragCoord must appear
> +*  before any use of gl_FragCoord.
> +*/
> +
> +#version 150
> +
> +vec2 a = gl_FragCoord.xy;
> +
> +in vec4 gl_FragCoord; //redeclaration after use should be illegal
> +
> +void main() {
> +
> +     gl_FragColor = vec4 (gl_FragCoord.x, gl_FragCoord.y,
> +                        gl_FragCoord.z, gl_FragCoord.z);
> +}
>

Nice job coming up with this one--it exposed a Mesa bug :)


> 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..c97a2d4
> --- /dev/null
> +++
> b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert
> @@ -0,0 +1,26 @@
> +// [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
> +*
> +* This test assumes that gl_FragCoord cannot be redeclared anywhere other
> than a fragment shader.
> +*/
> +
> +#version 150
> +
> +in vec4 gl_FragCoord; //redeclaration in a VS
> +
> +void main() {
> +
> +     gl_FragColor = vec4 (gl_FragCoord.x, gl_FragCoord.y,
> +                        gl_FragCoord.z, gl_FragCoord.z);
> +}
> --
> 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/20130806/3891ba58/attachment-0001.html>


More information about the Piglit mailing list