[Piglit] [PATCH 11/12] Linker tests for compute shaders: local work sizes.

Paul Berry stereotype441 at gmail.com
Thu Jan 9 11:00:02 PST 2014


These tests verify the linker rules for local work sizes (they must be
specified in at least one shader, and they must not conflict).
---
 tests/all.tests                                    |  3 ++
 .../linker/matched_local_work_sizes.shader_test    | 42 +++++++++++++++++++++
 .../linker/mismatched_local_work_sizes.shader_test | 43 ++++++++++++++++++++++
 .../linker/mix_compute_and_non_compute.shader_test | 32 ++++++++++++++++
 .../linker/no_local_work_size.shader_test          | 28 ++++++++++++++
 .../linker/one_local_work_size.shader_test         | 41 +++++++++++++++++++++
 6 files changed, 189 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test
 create mode 100644 tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test
 create mode 100644 tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test
 create mode 100644 tests/spec/arb_compute_shader/linker/no_local_work_size.shader_test
 create mode 100644 tests/spec/arb_compute_shader/linker/one_local_work_size.shader_test

diff --git a/tests/all.tests b/tests/all.tests
index eb2faf0..5bb0ed5 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2786,6 +2786,9 @@ spec['ARB_compute_shader'] = arb_compute_shader
 arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax')
 arb_compute_shader['compiler/work_group_size_too_large'] = \
     concurrent_test('arb_compute_shader-work_group_size_too_large')
+add_shader_test_dir(spec['ARB_compute_shader'],
+                    os.path.join(testsDir, 'spec', 'arb_compute_shader'),
+                    recursive=True)
 import_glsl_parser_tests(spec['ARB_compute_shader'],
                          os.path.join(testsDir, 'spec', 'arb_compute_shader'),
                          ['compiler'])
diff --git a/tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test b/tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test
new file mode 100644
index 0000000..67e850c
--- /dev/null
+++ b/tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test
@@ -0,0 +1,42 @@
+# From the ARB_compute_shader spec, in the section describing local
+# size declarations:
+#
+#     If multiple compute shaders attached to a single program object
+#     declare local work-group size, the declarations must be
+#     identical; otherwise a link-time error results. Furthermore, if
+#     a program object contains any compute shaders, at least one must
+#     contain an input layout qualifier specifying the local work
+#     sizes of the program, or a link-time error will occur.
+#
+# In this test, we link two shaders that have the same local work size.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 2) in;
+
+void foo();
+
+void main()
+{
+	foo();
+}
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 2) in;
+
+void foo()
+{
+}
+
+[test]
+link success
diff --git a/tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test b/tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test
new file mode 100644
index 0000000..e4872e1
--- /dev/null
+++ b/tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test
@@ -0,0 +1,43 @@
+# From the ARB_compute_shader spec, in the section describing local
+# size declarations:
+#
+#     If multiple compute shaders attached to a single program object
+#     declare local work-group size, the declarations must be
+#     identical; otherwise a link-time error results. Furthermore, if
+#     a program object contains any compute shaders, at least one must
+#     contain an input layout qualifier specifying the local work
+#     sizes of the program, or a link-time error will occur.
+#
+# In this test, we try to link two shaders that have different local
+# work sizes.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 2) in;
+
+void foo();
+
+void main()
+{
+	foo();
+}
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_y = 2) in;
+
+void foo()
+{
+}
+
+[test]
+link error
diff --git a/tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test b/tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test
new file mode 100644
index 0000000..603cbe7
--- /dev/null
+++ b/tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test
@@ -0,0 +1,32 @@
+# From the ARB_compute_shader spec:
+#
+#     In section 2.11.3, "Program Objects", add to the reasons that LinkProgram
+#     may fail, p. 61:
+#
+#         * The program object contains objects to form a compute shader (see
+#           section 5.5) and objects to form any other type of shader.
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+
+[vertex shader]
+#version 330
+
+void main()
+{
+	gl_Position = vec4(0.0);
+}
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+}
+
+[test]
+link error
diff --git a/tests/spec/arb_compute_shader/linker/no_local_work_size.shader_test b/tests/spec/arb_compute_shader/linker/no_local_work_size.shader_test
new file mode 100644
index 0000000..e9d773f
--- /dev/null
+++ b/tests/spec/arb_compute_shader/linker/no_local_work_size.shader_test
@@ -0,0 +1,28 @@
+# From the ARB_compute_shader spec, in the section describing local
+# size declarations:
+#
+#     If multiple compute shaders attached to a single program object
+#     declare local work-group size, the declarations must be
+#     identical; otherwise a link-time error results. Furthermore, if
+#     a program object contains any compute shaders, at least one must
+#     contain an input layout qualifier specifying the local work
+#     sizes of the program, or a link-time error will occur.
+#
+# In this test, we link a single shader which doesn't specify a local
+# work size.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+void main()
+{
+}
+
+[test]
+link error
diff --git a/tests/spec/arb_compute_shader/linker/one_local_work_size.shader_test b/tests/spec/arb_compute_shader/linker/one_local_work_size.shader_test
new file mode 100644
index 0000000..2b81f33
--- /dev/null
+++ b/tests/spec/arb_compute_shader/linker/one_local_work_size.shader_test
@@ -0,0 +1,41 @@
+# From the ARB_compute_shader spec, in the section describing local
+# size declarations:
+#
+#     If multiple compute shaders attached to a single program object
+#     declare local work-group size, the declarations must be
+#     identical; otherwise a link-time error results. Furthermore, if
+#     a program object contains any compute shaders, at least one must
+#     contain an input layout qualifier specifying the local work
+#     sizes of the program, or a link-time error will occur.
+#
+# In this test, we link two shaders, one of which specifies a local
+# work size, and one of which doesn't.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 2) in;
+
+void foo();
+
+void main()
+{
+	foo();
+}
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+void foo()
+{
+}
+
+[test]
+link success
-- 
1.8.5.2



More information about the Piglit mailing list