[Piglit] [PATCH 2/2] arb_compute_shader: A simple CS test with SSBO

Jordan Justen jordan.l.justen at intel.com
Tue Sep 29 17:10:22 PDT 2015


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

diff --git a/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test b/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test
new file mode 100644
index 0000000..4bf7e1c
--- /dev/null
+++ b/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test
@@ -0,0 +1,74 @@
+[require]
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_storage_buffer_object
+GL_ARB_shader_atomic_counters
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_shader_storage_buffer_object: require
+#extension GL_ARB_shader_atomic_counters: require
+
+#define SIZE 256u
+
+layout(local_size_x = SIZE) in;
+
+layout(binding = 0) uniform atomic_uint counter;
+
+layout(std430)
+buffer SSBO {
+	uint	u[SIZE];
+};
+
+uniform uint mode;
+
+void main()
+{
+	uint index = gl_LocalInvocationIndex;
+
+	switch (mode) {
+	case 0u:
+		u[index] = SIZE;
+		break;
+	case 1u:
+		u[index] = index;
+		break;
+	case 2u:
+		if (u[index] == SIZE)
+			atomicCounterIncrement(counter);
+		break;
+	case 3u:
+		if (u[index] == index)
+			atomicCounterIncrement(counter);
+		break;
+	}
+}
+
+[test]
+atomic counters 1
+ssbo 1024
+
+uniform uint mode 0
+compute 1 1 1
+probe atomic counter 0 == 0
+
+uniform uint mode 3
+compute 1 1 1
+probe atomic counter 0 == 0
+
+uniform uint mode 2
+compute 1 1 1
+probe atomic counter 0 == 256
+
+uniform uint mode 1
+compute 1 1 1
+probe atomic counter 0 == 256
+
+uniform uint mode 2
+compute 1 1 1
+probe atomic counter 0 == 256
+
+uniform uint mode 3
+compute 1 1 1
+probe atomic counter 0 == 512
-- 
2.5.1



More information about the Piglit mailing list