[4/7] arb_shading_language_420pack: More multiple layout qualifiers in a single declaration tests

Submitted by Andres Gomez on Oct. 22, 2016, 8:42 p.m.

Details

Message ID 20161022204226.31193-5-agomez@igalia.com
State Superseded
Headers show
Series "More duplicated layout-qualifier-names tests" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Andres Gomez Oct. 22, 2016, 8:42 p.m.
Added tests for the layout-qualifier-names "max_vertices",
"invocations", "vertices" and "local_size_[x|y|z]" which may have
redeclarations but all of them enforce that a redeclaration holds the
same value than in the previous declaration(s).

These tests check that multiple appearances of a layout-qualifier-name
across different layout qualifiers with different values in the same
declaration won't trigger a compile/link error.

From the ARB_shading_language_420pack spec:

    "More than one layout qualifier may appear in a single declaration. If
     the same layout-qualifier-name occurs in multiple layout qualifiers for
     the same declaration, the last one overrides the former ones."

Signed-off-by: Andres Gomez <agomez@igalia.com>
---
 ...-invocation-in-single-declaration-mismatch.geom | 31 ++++++++++++++++++++++
 .../multiple-invocation-in-single-declaration.geom | 29 ++++++++++++++++++++
 ...-local_size-in-single-declaration-mismatch.comp | 29 ++++++++++++++++++++
 .../multiple-local_size-in-single-declaration.comp | 29 ++++++++++++++++++++
 ...ax_vertices-in-single-declaration-mismatch.geom | 31 ++++++++++++++++++++++
 ...ultiple-max_vertices-in-single-declaration.geom | 31 ++++++++++++++++++++++
 ...le-vertices-in-single-declaration-mismatch.tesc | 30 +++++++++++++++++++++
 .../multiple-vertices-in-single-declaration.tesc   | 30 +++++++++++++++++++++
 8 files changed, 240 insertions(+)
 create mode 100644 tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
 create mode 100644 tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration.geom
 create mode 100644 tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
 create mode 100644 tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration.comp
 create mode 100644 tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom
 create mode 100644 tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration.geom
 create mode 100644 tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
 create mode 100644 tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration.tesc

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration-mismatch.geom b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
new file mode 100644
index 0000000..e55f667
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
@@ -0,0 +1,31 @@ 
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack
+// check_link: false
+// [end config]
+//
+// From the ARB_shading_language_420pack spec:
+//
+//    "More than one layout qualifier may appear in a single declaration. If
+//     the same layout-qualifier-name occurs in multiple layout qualifiers for
+//     the same declaration, the last one overrides the former ones."
+//
+// From the ARB_gpu_shader5 spec:
+//
+//    "If an invocation count is declared, all such declarations must
+//     specify the same count."
+
+#version 150
+#extension GL_ARB_shading_language_420pack: enable
+#extension GL_ARB_gpu_shader5 : enable
+
+#version 150
+
+layout(points, invocations=4) layout(invocations=3) in;
+layout(invocations=4) in;
+layout(triangle_strip, max_vertices=3) out;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration.geom b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration.geom
new file mode 100644
index 0000000..07a13f7
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration.geom
@@ -0,0 +1,29 @@ 
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack GL_ARB_gpu_shader5
+// check_link: false
+// [end config]
+//
+// From the ARB_shading_language_420pack spec:
+//
+//    "More than one layout qualifier may appear in a single declaration. If
+//     the same layout-qualifier-name occurs in multiple layout qualifiers for
+//     the same declaration, the last one overrides the former ones."
+//
+// From the ARB_gpu_shader5 spec:
+//
+//    "If an invocation count is declared, all such declarations must
+//     specify the same count."
+
+#version 150
+#extension GL_ARB_shading_language_420pack: enable
+#extension GL_ARB_gpu_shader5 : enable
+
+layout(points, invocations=3) layout(invocations=4) in;
+layout(invocations=4) in;
+layout(triangle_strip, max_vertices=3) out;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration-mismatch.comp b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
new file mode 100644
index 0000000..b4f49f0
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
@@ -0,0 +1,29 @@ 
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack GL_ARB_compute_shader
+// check_link: true
+// [end config]
+//
+// From the ARB_shading_language_420pack spec:
+//
+//    "More than one layout qualifier may appear in a single declaration. If
+//     the same layout-qualifier-name occurs in multiple layout qualifiers for
+//     the same declaration, the last one overrides the former ones."
+//
+// From the ARB_compute_shader spec:
+//
+//    "[If an input layout qualifier] is declared more than once in
+//     the same shader, all those declarations must indicate the same
+//     local work-group size; otherwise a compile-time error results."
+
+#version 150
+#extension GL_ARB_shading_language_420pack: enable
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_z = 2) layout(local_size_z = 1) in;
+layout(local_size_z = 2) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration.comp b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration.comp
new file mode 100644
index 0000000..53cdc98
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration.comp
@@ -0,0 +1,29 @@ 
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack GL_ARB_compute_shader
+// check_link: true
+// [end config]
+//
+// From the ARB_shading_language_420pack spec:
+//
+//    "More than one layout qualifier may appear in a single declaration. If
+//     the same layout-qualifier-name occurs in multiple layout qualifiers for
+//     the same declaration, the last one overrides the former ones."
+//
+// From the ARB_compute_shader spec:
+//
+//    "[If an input layout qualifier] is declared more than once in
+//     the same shader, all those declarations must indicate the same
+//     local work-group size; otherwise a compile-time error results."
+
+#version 150
+#extension GL_ARB_shading_language_420pack: enable
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_z = 1) layout(local_size_z = 2) in;
+layout(local_size_z = 2) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom
new file mode 100644
index 0000000..097d7c7
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom
@@ -0,0 +1,31 @@ 
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack
+// check_link: true
+// [end config]
+//
+// From the ARB_shading_language_420pack spec:
+//
+//    "More than one layout qualifier may appear in a single declaration. If
+//     the same layout-qualifier-name occurs in multiple layout qualifiers for
+//     the same declaration, the last one overrides the former ones."
+//
+// From section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says:
+//
+//    "All geometry shader output layout declarations in a program must declare the
+//     same layout and same value for max_vertices."
+
+#version 150
+#extension GL_ARB_shading_language_420pack: enable
+
+layout(lines) in;
+layout(line_strip, max_vertices=2) layout(max_vertices=3) out;
+
+in vec4 pos[];
+
+layout(max_vertices=2) out;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration.geom b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration.geom
new file mode 100644
index 0000000..88e1228
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration.geom
@@ -0,0 +1,31 @@ 
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack
+// check_link: true
+// [end config]
+//
+// From the ARB_shading_language_420pack spec:
+//
+//    "More than one layout qualifier may appear in a single declaration. If
+//     the same layout-qualifier-name occurs in multiple layout qualifiers for
+//     the same declaration, the last one overrides the former ones."
+//
+// From section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says:
+//
+//    "All geometry shader output layout declarations in a program must declare the
+//     same layout and same value for max_vertices."
+
+#version 150
+#extension GL_ARB_shading_language_420pack: enable
+
+layout(lines) in;
+layout(line_strip, max_vertices=2) layout(max_vertices=3) out;
+
+in vec4 pos[];
+
+layout(max_vertices=3) out;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
new file mode 100644
index 0000000..a4aa65a
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
@@ -0,0 +1,30 @@ 
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack GL_ARB_tessellation_shader
+// check_link: true
+// [end config]
+//
+// From the ARB_shading_language_420pack spec:
+//
+//    "More than one layout qualifier may appear in a single declaration. If
+//     the same layout-qualifier-name occurs in multiple layout qualifiers for
+//     the same declaration, the last one overrides the former ones."
+//
+// From the ARB_tessellation_shader spec:
+//
+//    "All tessellation control shader layout declarations in a program must
+//     specify the same output patch vertex count."
+
+#version 150
+#extension GL_ARB_shading_language_420pack: enable
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) layout(vertices = 4) out;
+layout(vertices = 3) out;
+
+void main() {
+    gl_out[gl_InvocationID].gl_Position = vec4(0.0);
+    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+    gl_TessLevelInner = float[2](1.0, 1.0);
+}
diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration.tesc b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration.tesc
new file mode 100644
index 0000000..f43f50f
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration.tesc
@@ -0,0 +1,30 @@ 
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack GL_ARB_tessellation_shader
+// check_link: true
+// [end config]
+//
+// From the ARB_shading_language_420pack spec:
+//
+//    "More than one layout qualifier may appear in a single declaration. If
+//     the same layout-qualifier-name occurs in multiple layout qualifiers for
+//     the same declaration, the last one overrides the former ones."
+//
+// From the ARB_tessellation_shader spec:
+//
+//    "All tessellation control shader layout declarations in a program must
+//     specify the same output patch vertex count."
+
+#version 150
+#extension GL_ARB_shading_language_420pack: enable
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 4) layout(vertices = 3) out;
+layout(vertices = 3) out;
+
+void main() {
+    gl_out[gl_InvocationID].gl_Position = vec4(0.0);
+    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
+    gl_TessLevelInner = float[2](1.0, 1.0);
+}

Comments

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>

On Sat, 2016-10-22 at 23:42 +0300, Andres Gomez wrote:
> Added tests for the layout-qualifier-names "max_vertices",
> "invocations", "vertices" and "local_size_[x|y|z]" which may have
> redeclarations but all of them enforce that a redeclaration holds the
> same value than in the previous declaration(s).
> 
> These tests check that multiple appearances of a layout-qualifier-
> name
> across different layout qualifiers with different values in the same
> declaration won't trigger a compile/link error.
> 
> From the ARB_shading_language_420pack spec:
> 
>     "More than one layout qualifier may appear in a single
> declaration. If
>      the same layout-qualifier-name occurs in multiple layout
> qualifiers for
>      the same declaration, the last one overrides the former ones."
> 
> Signed-off-by: Andres Gomez <agomez@igalia.com>
> ---
>  ...-invocation-in-single-declaration-mismatch.geom | 31
> ++++++++++++++++++++++
>  .../multiple-invocation-in-single-declaration.geom | 29
> ++++++++++++++++++++
>  ...-local_size-in-single-declaration-mismatch.comp | 29
> ++++++++++++++++++++
>  .../multiple-local_size-in-single-declaration.comp | 29
> ++++++++++++++++++++
>  ...ax_vertices-in-single-declaration-mismatch.geom | 31
> ++++++++++++++++++++++
>  ...ultiple-max_vertices-in-single-declaration.geom | 31
> ++++++++++++++++++++++
>  ...le-vertices-in-single-declaration-mismatch.tesc | 30
> +++++++++++++++++++++
>  .../multiple-vertices-in-single-declaration.tesc   | 30
> +++++++++++++++++++++
>  8 files changed, 240 insertions(+)
>  create mode 100644
> tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
>  create mode 100644
> tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-invocation-in-single-declaration.geom
>  create mode 100644
> tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
>  create mode 100644
> tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-local_size-in-single-declaration.comp
>  create mode 100644
> tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom
>  create mode 100644
> tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-max_vertices-in-single-declaration.geom
>  create mode 100644
> tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
>  create mode 100644
> tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-vertices-in-single-declaration.tesc
> 
> diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
> b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
> new file mode 100644
> index 0000000..e55f667
> --- /dev/null
> +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
> @@ -0,0 +1,31 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shading_language_420pack
> +// check_link: false
> +// [end config]
> +//
> +// From the ARB_shading_language_420pack spec:
> +//
> +//    "More than one layout qualifier may appear in a single
> declaration. If
> +//     the same layout-qualifier-name occurs in multiple layout
> qualifiers for
> +//     the same declaration, the last one overrides the former
> ones."
> +//
> +// From the ARB_gpu_shader5 spec:
> +//
> +//    "If an invocation count is declared, all such declarations
> must
> +//     specify the same count."
> +
> +#version 150
> +#extension GL_ARB_shading_language_420pack: enable
> +#extension GL_ARB_gpu_shader5 : enable
> +
> +#version 150
> +
> +layout(points, invocations=4) layout(invocations=3) in;
> +layout(invocations=4) in;
> +layout(triangle_strip, max_vertices=3) out;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-invocation-in-single-declaration.geom
> b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-invocation-in-single-declaration.geom
> new file mode 100644
> index 0000000..07a13f7
> --- /dev/null
> +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-invocation-in-single-declaration.geom
> @@ -0,0 +1,29 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shading_language_420pack
> GL_ARB_gpu_shader5
> +// check_link: false
> +// [end config]
> +//
> +// From the ARB_shading_language_420pack spec:
> +//
> +//    "More than one layout qualifier may appear in a single
> declaration. If
> +//     the same layout-qualifier-name occurs in multiple layout
> qualifiers for
> +//     the same declaration, the last one overrides the former
> ones."
> +//
> +// From the ARB_gpu_shader5 spec:
> +//
> +//    "If an invocation count is declared, all such declarations
> must
> +//     specify the same count."
> +
> +#version 150
> +#extension GL_ARB_shading_language_420pack: enable
> +#extension GL_ARB_gpu_shader5 : enable
> +
> +layout(points, invocations=3) layout(invocations=4) in;
> +layout(invocations=4) in;
> +layout(triangle_strip, max_vertices=3) out;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> new file mode 100644
> index 0000000..b4f49f0
> --- /dev/null
> +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> @@ -0,0 +1,29 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shading_language_420pack
> GL_ARB_compute_shader
> +// check_link: true

I think you need to remove this since the spec says it is a compile
time error.

> +// [end config]
> +//
> +// From the ARB_shading_language_420pack spec:
> +//
> +//    "More than one layout qualifier may appear in a single
> declaration. If
> +//     the same layout-qualifier-name occurs in multiple layout
> qualifiers for
> +//     the same declaration, the last one overrides the former
> ones."
> +//
> +// From the ARB_compute_shader spec:
> +//
> +//    "[If an input layout qualifier] is declared more than once in
> +//     the same shader, all those declarations must indicate the
> same
> +//     local work-group size; otherwise a compile-time error
> results."
> +
> +#version 150
> +#extension GL_ARB_shading_language_420pack: enable
> +#extension GL_ARB_compute_shader: enable
> +
> +layout(local_size_z = 2) layout(local_size_z = 1) in;
> +layout(local_size_z = 2) in;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-local_size-in-single-declaration.comp
> b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-local_size-in-single-declaration.comp
> new file mode 100644
> index 0000000..53cdc98
> --- /dev/null
> +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-local_size-in-single-declaration.comp
> @@ -0,0 +1,29 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shading_language_420pack
> GL_ARB_compute_shader
> +// check_link: true
> +// [end config]
> +//
> +// From the ARB_shading_language_420pack spec:
> +//
> +//    "More than one layout qualifier may appear in a single
> declaration. If
> +//     the same layout-qualifier-name occurs in multiple layout
> qualifiers for
> +//     the same declaration, the last one overrides the former
> ones."
> +//
> +// From the ARB_compute_shader spec:
> +//
> +//    "[If an input layout qualifier] is declared more than once in
> +//     the same shader, all those declarations must indicate the
> same
> +//     local work-group size; otherwise a compile-time error
> results."
> +
> +#version 150
> +#extension GL_ARB_shading_language_420pack: enable
> +#extension GL_ARB_compute_shader: enable
> +
> +layout(local_size_z = 1) layout(local_size_z = 2) in;
> +layout(local_size_z = 2) in;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom
> b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom
> new file mode 100644
> index 0000000..097d7c7
> --- /dev/null
> +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom
> @@ -0,0 +1,31 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shading_language_420pack
> +// check_link: true
> +// [end config]
> +//
> +// From the ARB_shading_language_420pack spec:
> +//
> +//    "More than one layout qualifier may appear in a single
> declaration. If
> +//     the same layout-qualifier-name occurs in multiple layout
> qualifiers for
> +//     the same declaration, the last one overrides the former
> ones."
> +//
> +// From section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50
> spec says:
> +//
> +//    "All geometry shader output layout declarations in a program
> must declare the
> +//     same layout and same value for max_vertices."
> +
> +#version 150
> +#extension GL_ARB_shading_language_420pack: enable
> +
> +layout(lines) in;
> +layout(line_strip, max_vertices=2) layout(max_vertices=3) out;
> +
> +in vec4 pos[];
> +
> +layout(max_vertices=2) out;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-max_vertices-in-single-declaration.geom
> b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-max_vertices-in-single-declaration.geom
> new file mode 100644
> index 0000000..88e1228
> --- /dev/null
> +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-max_vertices-in-single-declaration.geom
> @@ -0,0 +1,31 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shading_language_420pack
> +// check_link: true
> +// [end config]
> +//
> +// From the ARB_shading_language_420pack spec:
> +//
> +//    "More than one layout qualifier may appear in a single
> declaration. If
> +//     the same layout-qualifier-name occurs in multiple layout
> qualifiers for
> +//     the same declaration, the last one overrides the former
> ones."
> +//
> +// From section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50
> spec says:
> +//
> +//    "All geometry shader output layout declarations in a program
> must declare the
> +//     same layout and same value for max_vertices."
> +
> +#version 150
> +#extension GL_ARB_shading_language_420pack: enable
> +
> +layout(lines) in;
> +layout(line_strip, max_vertices=2) layout(max_vertices=3) out;
> +
> +in vec4 pos[];
> +
> +layout(max_vertices=3) out;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
> b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
> new file mode 100644
> index 0000000..a4aa65a
> --- /dev/null
> +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
> @@ -0,0 +1,30 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shading_language_420pack
> GL_ARB_tessellation_shader
> +// check_link: true
> +// [end config]
> +//
> +// From the ARB_shading_language_420pack spec:
> +//
> +//    "More than one layout qualifier may appear in a single
> declaration. If
> +//     the same layout-qualifier-name occurs in multiple layout
> qualifiers for
> +//     the same declaration, the last one overrides the former
> ones."
> +//
> +// From the ARB_tessellation_shader spec:
> +//
> +//    "All tessellation control shader layout declarations in a
> program must
> +//     specify the same output patch vertex count."
> +
> +#version 150
> +#extension GL_ARB_shading_language_420pack: enable
> +#extension GL_ARB_tessellation_shader: require
> +
> +layout(vertices = 3) layout(vertices = 4) out;
> +layout(vertices = 3) out;
> +
> +void main() {
> +    gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> +    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> +    gl_TessLevelInner = float[2](1.0, 1.0);
> +}
> diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-vertices-in-single-declaration.tesc
> b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-vertices-in-single-declaration.tesc
> new file mode 100644
> index 0000000..f43f50f
> --- /dev/null
> +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> qualifiers/multiple-vertices-in-single-declaration.tesc
> @@ -0,0 +1,30 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shading_language_420pack
> GL_ARB_tessellation_shader
> +// check_link: true
> +// [end config]
> +//
> +// From the ARB_shading_language_420pack spec:
> +//
> +//    "More than one layout qualifier may appear in a single
> declaration. If
> +//     the same layout-qualifier-name occurs in multiple layout
> qualifiers for
> +//     the same declaration, the last one overrides the former
> ones."
> +//
> +// From the ARB_tessellation_shader spec:
> +//
> +//    "All tessellation control shader layout declarations in a
> program must
> +//     specify the same output patch vertex count."
> +
> +#version 150
> +#extension GL_ARB_shading_language_420pack: enable
> +#extension GL_ARB_tessellation_shader: require
> +
> +layout(vertices = 4) layout(vertices = 3) out;
> +layout(vertices = 3) out;
> +
> +void main() {
> +    gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> +    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> +    gl_TessLevelInner = float[2](1.0, 1.0);
> +}
On Mon, 2016-10-24 at 11:44 +1100, Timothy Arceri wrote:
> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>

I forgot to point out I had one comment below :)


> 
> On Sat, 2016-10-22 at 23:42 +0300, Andres Gomez wrote:
> > 
> > Added tests for the layout-qualifier-names "max_vertices",
> > "invocations", "vertices" and "local_size_[x|y|z]" which may have
> > redeclarations but all of them enforce that a redeclaration holds
> > the
> > same value than in the previous declaration(s).
> > 
> > These tests check that multiple appearances of a layout-qualifier-
> > name
> > across different layout qualifiers with different values in the
> > same
> > declaration won't trigger a compile/link error.
> > 
> > From the ARB_shading_language_420pack spec:
> > 
> >     "More than one layout qualifier may appear in a single
> > declaration. If
> >      the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> >      the same declaration, the last one overrides the former ones."
> > 
> > Signed-off-by: Andres Gomez <agomez@igalia.com>
> > ---
> >  ...-invocation-in-single-declaration-mismatch.geom | 31
> > ++++++++++++++++++++++
> >  .../multiple-invocation-in-single-declaration.geom | 29
> > ++++++++++++++++++++
> >  ...-local_size-in-single-declaration-mismatch.comp | 29
> > ++++++++++++++++++++
> >  .../multiple-local_size-in-single-declaration.comp | 29
> > ++++++++++++++++++++
> >  ...ax_vertices-in-single-declaration-mismatch.geom | 31
> > ++++++++++++++++++++++
> >  ...ultiple-max_vertices-in-single-declaration.geom | 31
> > ++++++++++++++++++++++
> >  ...le-vertices-in-single-declaration-mismatch.tesc | 30
> > +++++++++++++++++++++
> >  .../multiple-vertices-in-single-declaration.tesc   | 30
> > +++++++++++++++++++++
> >  8 files changed, 240 insertions(+)
> >  create mode 100644
> > tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
> >  create mode 100644
> > tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-invocation-in-single-declaration.geom
> >  create mode 100644
> > tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> >  create mode 100644
> > tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration.comp
> >  create mode 100644
> > tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-max_vertices-in-single-declaration-
> > mismatch.geom
> >  create mode 100644
> > tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-max_vertices-in-single-declaration.geom
> >  create mode 100644
> > tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
> >  create mode 100644
> > tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-vertices-in-single-declaration.tesc
> > 
> > diff --git
> > a/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
> > b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
> > new file mode 100644
> > index 0000000..e55f667
> > --- /dev/null
> > +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-invocation-in-single-declaration-mismatch.geom
> > @@ -0,0 +1,31 @@
> > +// [config]
> > +// expect_result: fail
> > +// glsl_version: 1.50
> > +// require_extensions: GL_ARB_shading_language_420pack
> > +// check_link: false
> > +// [end config]
> > +//
> > +// From the ARB_shading_language_420pack spec:
> > +//
> > +//    "More than one layout qualifier may appear in a single
> > declaration. If
> > +//     the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> > +//     the same declaration, the last one overrides the former
> > ones."
> > +//
> > +// From the ARB_gpu_shader5 spec:
> > +//
> > +//    "If an invocation count is declared, all such declarations
> > must
> > +//     specify the same count."
> > +
> > +#version 150
> > +#extension GL_ARB_shading_language_420pack: enable
> > +#extension GL_ARB_gpu_shader5 : enable
> > +
> > +#version 150
> > +
> > +layout(points, invocations=4) layout(invocations=3) in;
> > +layout(invocations=4) in;
> > +layout(triangle_strip, max_vertices=3) out;
> > +
> > +void main()
> > +{
> > +}
> > diff --git
> > a/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-invocation-in-single-declaration.geom
> > b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-invocation-in-single-declaration.geom
> > new file mode 100644
> > index 0000000..07a13f7
> > --- /dev/null
> > +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-invocation-in-single-declaration.geom
> > @@ -0,0 +1,29 @@
> > +// [config]
> > +// expect_result: pass
> > +// glsl_version: 1.50
> > +// require_extensions: GL_ARB_shading_language_420pack
> > GL_ARB_gpu_shader5
> > +// check_link: false
> > +// [end config]
> > +//
> > +// From the ARB_shading_language_420pack spec:
> > +//
> > +//    "More than one layout qualifier may appear in a single
> > declaration. If
> > +//     the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> > +//     the same declaration, the last one overrides the former
> > ones."
> > +//
> > +// From the ARB_gpu_shader5 spec:
> > +//
> > +//    "If an invocation count is declared, all such declarations
> > must
> > +//     specify the same count."
> > +
> > +#version 150
> > +#extension GL_ARB_shading_language_420pack: enable
> > +#extension GL_ARB_gpu_shader5 : enable
> > +
> > +layout(points, invocations=3) layout(invocations=4) in;
> > +layout(invocations=4) in;
> > +layout(triangle_strip, max_vertices=3) out;
> > +
> > +void main()
> > +{
> > +}
> > diff --git
> > a/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> > b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> > new file mode 100644
> > index 0000000..b4f49f0
> > --- /dev/null
> > +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> > @@ -0,0 +1,29 @@
> > +// [config]
> > +// expect_result: fail
> > +// glsl_version: 1.50
> > +// require_extensions: GL_ARB_shading_language_420pack
> > GL_ARB_compute_shader
> > +// check_link: true
> 
> I think you need to remove this since the spec says it is a compile
> time error.
> 
> > 
> > +// [end config]
> > +//
> > +// From the ARB_shading_language_420pack spec:
> > +//
> > +//    "More than one layout qualifier may appear in a single
> > declaration. If
> > +//     the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> > +//     the same declaration, the last one overrides the former
> > ones."
> > +//
> > +// From the ARB_compute_shader spec:
> > +//
> > +//    "[If an input layout qualifier] is declared more than once
> > in
> > +//     the same shader, all those declarations must indicate the
> > same
> > +//     local work-group size; otherwise a compile-time error
> > results."
> > +
> > +#version 150
> > +#extension GL_ARB_shading_language_420pack: enable
> > +#extension GL_ARB_compute_shader: enable
> > +
> > +layout(local_size_z = 2) layout(local_size_z = 1) in;
> > +layout(local_size_z = 2) in;
> > +
> > +void main()
> > +{
> > +}
> > diff --git
> > a/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration.comp
> > b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration.comp
> > new file mode 100644
> > index 0000000..53cdc98
> > --- /dev/null
> > +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration.comp
> > @@ -0,0 +1,29 @@
> > +// [config]
> > +// expect_result: pass
> > +// glsl_version: 1.50
> > +// require_extensions: GL_ARB_shading_language_420pack
> > GL_ARB_compute_shader
> > +// check_link: true
> > +// [end config]
> > +//
> > +// From the ARB_shading_language_420pack spec:
> > +//
> > +//    "More than one layout qualifier may appear in a single
> > declaration. If
> > +//     the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> > +//     the same declaration, the last one overrides the former
> > ones."
> > +//
> > +// From the ARB_compute_shader spec:
> > +//
> > +//    "[If an input layout qualifier] is declared more than once
> > in
> > +//     the same shader, all those declarations must indicate the
> > same
> > +//     local work-group size; otherwise a compile-time error
> > results."
> > +
> > +#version 150
> > +#extension GL_ARB_shading_language_420pack: enable
> > +#extension GL_ARB_compute_shader: enable
> > +
> > +layout(local_size_z = 1) layout(local_size_z = 2) in;
> > +layout(local_size_z = 2) in;
> > +
> > +void main()
> > +{
> > +}
> > diff --git
> > a/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-max_vertices-in-single-declaration-
> > mismatch.geom
> > b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-max_vertices-in-single-declaration-
> > mismatch.geom
> > new file mode 100644
> > index 0000000..097d7c7
> > --- /dev/null
> > +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-max_vertices-in-single-declaration-
> > mismatch.geom
> > @@ -0,0 +1,31 @@
> > +// [config]
> > +// expect_result: fail
> > +// glsl_version: 1.50
> > +// require_extensions: GL_ARB_shading_language_420pack
> > +// check_link: true
> > +// [end config]
> > +//
> > +// From the ARB_shading_language_420pack spec:
> > +//
> > +//    "More than one layout qualifier may appear in a single
> > declaration. If
> > +//     the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> > +//     the same declaration, the last one overrides the former
> > ones."
> > +//
> > +// From section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50
> > spec says:
> > +//
> > +//    "All geometry shader output layout declarations in a program
> > must declare the
> > +//     same layout and same value for max_vertices."
> > +
> > +#version 150
> > +#extension GL_ARB_shading_language_420pack: enable
> > +
> > +layout(lines) in;
> > +layout(line_strip, max_vertices=2) layout(max_vertices=3) out;
> > +
> > +in vec4 pos[];
> > +
> > +layout(max_vertices=2) out;
> > +
> > +void main()
> > +{
> > +}
> > diff --git
> > a/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-max_vertices-in-single-declaration.geom
> > b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-max_vertices-in-single-declaration.geom
> > new file mode 100644
> > index 0000000..88e1228
> > --- /dev/null
> > +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-max_vertices-in-single-declaration.geom
> > @@ -0,0 +1,31 @@
> > +// [config]
> > +// expect_result: pass
> > +// glsl_version: 1.50
> > +// require_extensions: GL_ARB_shading_language_420pack
> > +// check_link: true
> > +// [end config]
> > +//
> > +// From the ARB_shading_language_420pack spec:
> > +//
> > +//    "More than one layout qualifier may appear in a single
> > declaration. If
> > +//     the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> > +//     the same declaration, the last one overrides the former
> > ones."
> > +//
> > +// From section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50
> > spec says:
> > +//
> > +//    "All geometry shader output layout declarations in a program
> > must declare the
> > +//     same layout and same value for max_vertices."
> > +
> > +#version 150
> > +#extension GL_ARB_shading_language_420pack: enable
> > +
> > +layout(lines) in;
> > +layout(line_strip, max_vertices=2) layout(max_vertices=3) out;
> > +
> > +in vec4 pos[];
> > +
> > +layout(max_vertices=3) out;
> > +
> > +void main()
> > +{
> > +}
> > diff --git
> > a/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
> > b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
> > new file mode 100644
> > index 0000000..a4aa65a
> > --- /dev/null
> > +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc
> > @@ -0,0 +1,30 @@
> > +// [config]
> > +// expect_result: fail
> > +// glsl_version: 1.50
> > +// require_extensions: GL_ARB_shading_language_420pack
> > GL_ARB_tessellation_shader
> > +// check_link: true
> > +// [end config]
> > +//
> > +// From the ARB_shading_language_420pack spec:
> > +//
> > +//    "More than one layout qualifier may appear in a single
> > declaration. If
> > +//     the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> > +//     the same declaration, the last one overrides the former
> > ones."
> > +//
> > +// From the ARB_tessellation_shader spec:
> > +//
> > +//    "All tessellation control shader layout declarations in a
> > program must
> > +//     specify the same output patch vertex count."
> > +
> > +#version 150
> > +#extension GL_ARB_shading_language_420pack: enable
> > +#extension GL_ARB_tessellation_shader: require
> > +
> > +layout(vertices = 3) layout(vertices = 4) out;
> > +layout(vertices = 3) out;
> > +
> > +void main() {
> > +    gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> > +    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> > +    gl_TessLevelInner = float[2](1.0, 1.0);
> > +}
> > diff --git
> > a/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-vertices-in-single-declaration.tesc
> > b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-vertices-in-single-declaration.tesc
> > new file mode 100644
> > index 0000000..f43f50f
> > --- /dev/null
> > +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-vertices-in-single-declaration.tesc
> > @@ -0,0 +1,30 @@
> > +// [config]
> > +// expect_result: pass
> > +// glsl_version: 1.50
> > +// require_extensions: GL_ARB_shading_language_420pack
> > GL_ARB_tessellation_shader
> > +// check_link: true
> > +// [end config]
> > +//
> > +// From the ARB_shading_language_420pack spec:
> > +//
> > +//    "More than one layout qualifier may appear in a single
> > declaration. If
> > +//     the same layout-qualifier-name occurs in multiple layout
> > qualifiers for
> > +//     the same declaration, the last one overrides the former
> > ones."
> > +//
> > +// From the ARB_tessellation_shader spec:
> > +//
> > +//    "All tessellation control shader layout declarations in a
> > program must
> > +//     specify the same output patch vertex count."
> > +
> > +#version 150
> > +#extension GL_ARB_shading_language_420pack: enable
> > +#extension GL_ARB_tessellation_shader: require
> > +
> > +layout(vertices = 4) layout(vertices = 3) out;
> > +layout(vertices = 3) out;
> > +
> > +void main() {
> > +    gl_out[gl_InvocationID].gl_Position = vec4(0.0);
> > +    gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
> > +    gl_TessLevelInner = float[2](1.0, 1.0);
> > +}
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
On Mon, 2016-10-24 at 11:44 +1100, Timothy Arceri wrote:
> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
> 
> On Sat, 2016-10-22 at 23:42 +0300, Andres Gomez wrote:

[snip]

> > diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> > b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> > new file mode 100644
> > index 0000000..b4f49f0
> > --- /dev/null
> > +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-
> > qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
> > @@ -0,0 +1,29 @@
> > +// [config]
> > +// expect_result: fail
> > +// glsl_version: 1.50
> > +// require_extensions: GL_ARB_shading_language_420pack
> > GL_ARB_compute_shader
> > +// check_link: true
> 
> 
> I think you need to remove this since the spec says it is a compile
> time error.

Good catch!

The spec specifies compile-time error if the mismatch is in the same
shader and link-time error if the mismatch is among shaders in the same
program.

I'll update this (and other tests that I've added in relation with
local_size).

Thanks for the review!