[Piglit] [PATCH 04/12] Test compilation rules related to compute shader layout qualifiers.

Paul Berry stereotype441 at gmail.com
Thu Jan 9 10:59:55 PST 2014


---
 .../compiler/default_local_size.comp               | 39 ++++++++++++++++++++++
 .../compiler/mismatched_local_size.comp            | 21 ++++++++++++
 .../compiler/negative_local_size.comp              | 26 +++++++++++++++
 .../compiler/zero_local_size.comp                  | 26 +++++++++++++++
 4 files changed, 112 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/compiler/default_local_size.comp
 create mode 100644 tests/spec/arb_compute_shader/compiler/mismatched_local_size.comp
 create mode 100644 tests/spec/arb_compute_shader/compiler/negative_local_size.comp
 create mode 100644 tests/spec/arb_compute_shader/compiler/zero_local_size.comp

diff --git a/tests/spec/arb_compute_shader/compiler/default_local_size.comp b/tests/spec/arb_compute_shader/compiler/default_local_size.comp
new file mode 100644
index 0000000..81fb6e3
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/default_local_size.comp
@@ -0,0 +1,39 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the ARB_compute_shader spec:
+//
+//     Layout qualifier identifiers for compute shader inputs are the work-group 
+//     size qualifiers:
+//
+//         layout-qualifier-id
+//             local_size_x = integer-constant
+//             local_size_y = integer-constant
+//             local_size_z = integer-constant
+//
+//     <local_size_x>, <local_size_y>, and <local_size_z> are used to define the
+//     local size of the kernel defined by the compute shader in the first,
+//     second, and third dimension, respectively. The default size in each
+//     dimension is 1. If a shader does not specify a size for one of the
+//     dimensions, that dimension will have a size of 1.
+//
+// This test verifies that unspecified local_size dimensions default
+// to 1, by taking advantage of the fact that conflicting layouts will
+// cause a compiler error.
+
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+// All 3 of the following layouts should be equivalent, since
+// unspecified sizes default to 1.
+layout(local_size_x = 1) in;
+layout(local_size_y = 1) in;
+layout(local_size_z = 1) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_compute_shader/compiler/mismatched_local_size.comp b/tests/spec/arb_compute_shader/compiler/mismatched_local_size.comp
new file mode 100644
index 0000000..6f83a32
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/mismatched_local_size.comp
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// 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 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 2) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_compute_shader/compiler/negative_local_size.comp b/tests/spec/arb_compute_shader/compiler/negative_local_size.comp
new file mode 100644
index 0000000..0a84019
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/negative_local_size.comp
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the ARB_compute_shader spec:
+//
+//     <local_size_x>, <local_size_y>, and <local_size_z> are used to
+//     define the local size of the kernel defined by the compute
+//     shader in the first, second, and third dimension,
+//     respectively. The default size in each dimension is 1. If a
+//     shader does not specify a size for one of the dimensions, that
+//     dimension will have a size of 1.
+//
+// Although it's not explicitly stated, it seems reasonable to assume
+// that a local size less than 0 is prohibited.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_y = -1) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_compute_shader/compiler/zero_local_size.comp b/tests/spec/arb_compute_shader/compiler/zero_local_size.comp
new file mode 100644
index 0000000..fbadf3e
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/zero_local_size.comp
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the ARB_compute_shader spec:
+//
+//     <local_size_x>, <local_size_y>, and <local_size_z> are used to
+//     define the local size of the kernel defined by the compute
+//     shader in the first, second, and third dimension,
+//     respectively. The default size in each dimension is 1. If a
+//     shader does not specify a size for one of the dimensions, that
+//     dimension will have a size of 1.
+//
+// Although it's not explicitly stated, it seems reasonable to assume
+// that a local size of 0 is prohibited.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_y = 0) in;
+
+void main()
+{
+}
-- 
1.8.5.2



More information about the Piglit mailing list