An implementation bug in mesa caused these values to be computed
incorrectly. Make sure that they work as defined.

Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu>
---
 .../execution/global-invocation-id.shader_test     | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 
tests/spec/arb_compute_variable_group_size/execution/global-invocation-id.shader_test

diff --git 
a/tests/spec/arb_compute_variable_group_size/execution/global-invocation-id.shader_test
 
b/tests/spec/arb_compute_variable_group_size/execution/global-invocation-id.shader_test
new file mode 100644
index 000000000..24f2f1d05
--- /dev/null
+++ 
b/tests/spec/arb_compute_variable_group_size/execution/global-invocation-id.shader_test
@@ -0,0 +1,44 @@
+# Simple test that verifies gl_GlobalInvocationID derived values are
+# computed properly.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_compute_variable_group_size
+GL_ARB_shader_storage_buffer_object
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: require
+#extension GL_ARB_compute_variable_group_size: require
+#extension GL_ARB_shader_storage_buffer_object: require
+
+layout(local_size_variable) in;
+
+layout(std430)
+buffer SSBO {
+       uvec2 id[4];
+};
+
+void main()
+{
+       uint g = gl_GlobalInvocationID.x;
+       uint l = gl_LocalInvocationID.x;
+       uint t = gl_WorkGroupID.x * gl_LocalGroupSizeARB.x + 
gl_LocalInvocationID.x;
+       id[t] = uvec2(g, l);
+}
+
+[test]
+ssbo 0 32
+
+compute group size 2 1 1 2 1 1
+
+probe ssbo uint 0  0 == 0
+probe ssbo uint 0  4 == 0
+probe ssbo uint 0  8 == 1
+probe ssbo uint 0 12 == 1
+probe ssbo uint 0 16 == 2
+probe ssbo uint 0 20 == 0
+probe ssbo uint 0 24 == 3
+probe ssbo uint 0 28 == 1
-- 
2.13.6

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to