[Piglit] [PATCH V3] arb_fragment_coord_conventions compiler/parser

Ian Romanick idr at freedesktop.org
Wed Aug 7 17:25:10 PDT 2013


On 08/06/2013 02:19 PM, Steve Miller wrote:
> arb_fragment_coord_conventions: compiler/parser tests
>
> Compiler test for layout qualifiers and redeclaration of gl_FragCoord.
>
> v2 commit : typecast data to fragcolor as vec4 (was error in original)
> v3 commit : added entry to all.tests for compiler directory
>     	    compiler tests now require gl110 and extension. piglit passes

All the same formatting / odd code comments about the GLSL 1.50 test 
apply to these as well.

Also, since these tests are explicitly "#version 110" it's a little 
weird to quote the GLSL 1.50 spec for justification.  Instead, you 
should quote the GL_ARB_fragment_coord_conventions spec.  The text in 
the extension should be similar, if not identical.  The main change is 
the spec reference (i.e., "The GL_ARB_fragment_coord_conventions spec 
says" instead of "Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 
1.50 spec says").

> ---
>   tests/all.tests                                    |  3 +++
>   .../basic-qualifiers-both-origin-and-pixel.frag    | 29 +++++++++++++++++++++
>   .../compiler/basic-qualifiers-layout-illegal.frag  | 29 +++++++++++++++++++++
>   .../basic-qualifiers-layout-illegal02.frag         | 29 +++++++++++++++++++++
>   .../compiler/basic-qualifiers-nothing.frag         | 27 +++++++++++++++++++
>   .../compiler/basic-qualifiers-origin.frag          | 28 ++++++++++++++++++++
>   .../compiler/basic-qualifiers-pixel-center.frag    | 28 ++++++++++++++++++++
>   .../compiler/redeclaration-after-use.frag          | 25 ++++++++++++++++++
>   .../compiler/redeclaration-outside-fs.vert         | 30 ++++++++++++++++++++++
>   9 files changed, 228 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-layout-illegal02.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
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 2f32120..915f4bc 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1083,6 +1083,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..d1c784e
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-both-origin-and-pixel.frag
> @@ -0,0 +1,29 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.10
> +// 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 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +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..d194db2
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal.frag

Since there are multiple of these, this should be 
basic-qualifiers-layout-illegal-01.frag.  The digits should be separated 
from the words with a dash.  It might be even better to name these 
basic-qualifiers-layout-PointCoord.frag and 
basic-qualifiers-layout-FrontFacing.frag, but I don't have a strong 
opinion.  Paul?

> @@ -0,0 +1,29 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.10
> +// 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
> +*
> +* 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 = 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-illegal02.frag b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal02.frag
> new file mode 100644
> index 0000000..c7d7226
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-layout-illegal02.frag
> @@ -0,0 +1,29 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.10
> +// 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
> +*
> +* 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 = 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..a7f6c1d
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-nothing.frag
> @@ -0,0 +1,27 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.10
> +// 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).
> +*
> +*  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 = 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..514c38c
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-origin.frag
> @@ -0,0 +1,28 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.10
> +// 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 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +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..ec6cf76
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/basic-qualifiers-pixel-center.frag
> @@ -0,0 +1,28 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.10
> +// 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 110
> +
> +#extension GL_ARB_fragment_coord_conventions : require
> +
> +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..f5dbb5c
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-after-use.frag
> @@ -0,0 +1,25 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.10
> +// 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:
> +*  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 = vec4 (gl_FragCoord.x, gl_FragCoord.y,
> +     		    	 gl_FragCoord.z, gl_FragCoord.z);
> +}
> 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..e507d6c
> --- /dev/null
> +++ b/tests/spec/arb_fragment_coord_conventions/compiler/redeclaration-outside-fs.vert
> @@ -0,0 +1,30 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.10
> +// 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
> +*
> +* 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 gl_FragCoord; //redeclaration in a VS
> +
> +void main() {
> +
> +     gl_FragColor = vec4 (gl_FragCoord.x, gl_FragCoord.y,
> +     		    	 gl_FragCoord.z, gl_FragCoord.z);

This test will actually fail for other reasons too... like using 
gl_FragColor or gl_FragCoord. :)

It might also be worth having a test or two that apply the gl_FragCoord 
layout qualifiers to other variables in the vertex shader (like your 
gl_FrontFacing test).

Also, a test that applies the layout qualifiers to a user-defined 
varying in the fragment shader.

> +}



More information about the Piglit mailing list