summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2015-09-29 16:52:03 -0700
committerJordan Justen <jordan.l.justen@intel.com>2015-09-30 11:33:28 -0700
commit7a034f967bcc40e9451bb0e35dff01e36b1a9f95 (patch)
tree076ac224ca8dc9d27eff8de25a4b48d00eadfc70
parentc2bdb58b230e959c4df5617bbfd111d33604e94f (diff)
arb_compute_shader: A simple CS test with SSBO
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
-rw-r--r--tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test74
1 files changed, 74 insertions, 0 deletions
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 000000000..4bf7e1c23
--- /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