[Piglit] [PATCH 09/11] arb_compute_shader: Test simple usage of barrier function
Jordan Justen
jordan.l.justen at intel.com
Sun Jun 1 17:39:14 PDT 2014
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
.../execution/simple-barrier.shader_test | 56 ++++++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 tests/spec/arb_compute_shader/execution/simple-barrier.shader_test
diff --git a/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test b/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test
new file mode 100644
index 0000000..665b381
--- /dev/null
+++ b/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test
@@ -0,0 +1,56 @@
+# Verify simple usage of the barrier function
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_image_load_store
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_shader_image_load_store: enable
+
+writeonly uniform image2D tex;
+
+layout(local_size_x = 8, local_size_y = 8) in;
+
+shared bool passed;
+const uint size2 = gl_WorkGroupSize.x * gl_WorkGroupSize.y;
+shared uint data[size2];
+
+void main()
+{
+ passed = true;
+ barrier();
+
+ // Fill shared array with data
+ data[gl_LocalInvocationIndex] = gl_LocalInvocationIndex;
+ barrier();
+
+ // Check the data of the another invocation within the local group
+ uint expect = (gl_LocalInvocationIndex + (size2 >> 1u)) % size2;
+ if (data[expect] != expect) {
+ passed = false;
+ }
+ barrier();
+
+ vec4 color;
+ if (passed) {
+ color = vec4(0, 1, 0, 0);
+ } else {
+ color = vec4(1, 0, 0, 0);
+ }
+
+ ivec2 coord = ivec2(gl_GlobalInvocationID.xy);
+ imageStore(tex, coord, color);
+}
+
+[test]
+uniform int tex 0
+texture rgbw 0 (16, 16)
+image texture 0
+fb tex 2d 0
+
+compute 2 2 1
+probe all rgba 0.0 1.0 0.0 0.0
--
2.0.0.rc4
More information about the Piglit
mailing list