5 GL_ARB_shader_atomic_counters
9 #extension GL_ARB_compute_shader: require
10 #extension GL_ARB_shader_atomic_counters: require
12 layout(local_size_x = 32) in;
17 layout(binding = 0) uniform atomic_uint pass;
18 layout(binding = 0) uniform atomic_uint fail;
22 if (gl_LocalInvocationIndex == 0u) {
29 /* Each local invocation should see a unique value. Each value
30 * observed is tracked in "mask." The test automatically fails if a
31 * duplicate value is observed. The test passes once all 32 possible
32 * values have been observed.
34 int f = atomicAdd(value, 4);
35 uint i = uint(f) / 4u;
40 /* If the bit was already set, the test fails. */
41 uint r = atomicOr(mask, m);
43 atomicCounterIncrement(fail);
45 /* Once all 32 bits are set, the test passes. */
46 if ((r | m) == 0xffffffffu)
47 atomicCounterIncrement(pass);
49 atomicCounterIncrement(fail);
56 probe atomic counter 0 == 24
57 probe atomic counter 1 == 0