[Piglit] [PATCH 06/12] Test ARB_compute_shader built-in constant gl_WorkGroupSize.
Paul Berry
stereotype441 at gmail.com
Thu Jan 9 10:59:57 PST 2014
---
.../compiler/gl_WorkGroupSize_before_layout.comp | 22 ++++++++++++++++
.../compiler/gl_WorkGroupSize_matches_layout.comp | 29 ++++++++++++++++++++++
.../compiler/gl_WorkGroupSize_without_layout.comp | 18 ++++++++++++++
3 files changed, 69 insertions(+)
create mode 100644 tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp
create mode 100644 tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp
create mode 100644 tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp
diff --git a/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp
new file mode 100644
index 0000000..23324e3
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the GLSL 4.4 spec, section 7.1 (Built-in Language Variables):
+//
+// It is a compile-time error to use gl_WorkGroupSize in a shader
+// that does not declare a fixed local group size, or before that
+// shader has declared a fixed local group size, using
+// local_size_x, local_size_y, and local_size_z.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+void main()
+{
+ ivec3 size = gl_WorkGroupSize;
+}
+
+layout(local_size_x = 3, local_size_y = 5, local_size_z = 7) in;
diff --git a/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp
new file mode 100644
index 0000000..094bcd9
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp
@@ -0,0 +1,29 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the GLSL 4.4 spec, section 7.1 (Built-in Language Variables):
+//
+// The built-in constant gl_WorkGroupSize is a compute-shader
+// constant containing the local work-group size of the
+// shader. The size of the work group in the X, Y, and Z
+// dimensions is stored in the x, y, and z components. The
+// constants values in gl_WorkGroupSize will match those specified
+// in the required local_size_x, local_size_y, and local_size_z
+// layout qualifiers for the current shader. This is a constant so
+// that it can be used to size arrays of memory that can be shared
+// within the local work group.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 3, local_size_y = 5, local_size_z = 7) in;
+
+void main()
+{
+ int x[gl_WorkGroupSize.x == 3 ? 1 : -1];
+ int y[gl_WorkGroupSize.y == 5 ? 1 : -1];
+ int z[gl_WorkGroupSize.z == 7 ? 1 : -1];
+}
diff --git a/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp
new file mode 100644
index 0000000..cec8c45
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the GLSL 4.4 spec, section 7.1 (Built-in Language Variables):
+//
+// It is a compile-time error to use gl_WorkGroupSize in a shader
+// that does not declare a fixed local group size ...
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+void main()
+{
+ ivec3 size = gl_WorkGroupSize;
+}
--
1.8.5.2
More information about the Piglit
mailing list