[Piglit] [PATCH 4/9] arb_shading_language_420pack: More multiple layout qualifiers in a single declaration tests

Andres Gomez agomez at igalia.com
Wed Oct 26 16:14:11 UTC 2016


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."

V2: Removed link check, as suggested by Timothy.

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>
Signed-off-by: Andres Gomez <agomez at igalia.com>
---
 ...-invocation-in-single-declaration-mismatch.geom | 31 ++++++++++++++++++++++
 .../multiple-invocation-in-single-declaration.geom | 29 ++++++++++++++++++++
 ...-local_size-in-single-declaration-mismatch.comp | 28 +++++++++++++++++++
 .../multiple-local_size-in-single-declaration.comp | 28 +++++++++++++++++++
 ...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, 238 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..fa96e55
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration-mismatch.comp
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack GL_ARB_compute_shader
+// [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..e2fba9c
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration.comp
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shading_language_420pack GL_ARB_compute_shader
+// [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);
+}
-- 
2.9.3



More information about the Piglit mailing list