[Piglit] [PATCH 4/4] cs: Add test of barrier() function that uses atomic counters

Jordan Justen jordan.l.justen at intel.com
Sat Nov 22 11:53:15 PST 2014


A simple compute shader that uses atomics with a barrier call.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 .../execution/simple-barrier-atomics.shader_test   | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/execution/simple-barrier-atomics.shader_test

diff --git a/tests/spec/arb_compute_shader/execution/simple-barrier-atomics.shader_test b/tests/spec/arb_compute_shader/execution/simple-barrier-atomics.shader_test
new file mode 100644
index 0000000..f9a716a
--- /dev/null
+++ b/tests/spec/arb_compute_shader/execution/simple-barrier-atomics.shader_test
@@ -0,0 +1,35 @@
+# Verify simple usage of the barrier function
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_atomic_counters
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_shader_atomic_counters: require
+
+layout(binding = 0) uniform atomic_uint a0;
+layout(binding = 0) uniform atomic_uint a1;
+
+layout(local_size_x = 64, local_size_y = 16) in;
+
+void main()
+{
+        atomicCounterIncrement(a0);
+
+	barrier();
+
+        if (atomicCounter(a0) == 1024u) {
+	        atomicCounterIncrement(a1);
+	}
+}
+
+[test]
+atomic counters 2
+
+compute 1 1 1
+probe atomic counter 0 == 1024
+probe atomic counter 1 == 1024
-- 
2.1.1



More information about the Piglit mailing list