5 GL_ARB_shader_atomic_counters
6 GL_INTEL_shader_atomic_float_minmax
10 #extension GL_ARB_compute_shader: require
11 #extension GL_ARB_shader_atomic_counters: require
12 #extension GL_INTEL_shader_atomic_float_minmax: require
14 layout(local_size_x = 32) in;
19 layout(binding = 0) uniform atomic_uint pass;
20 layout(binding = 0) uniform atomic_uint fail;
24 if (gl_LocalInvocationIndex == 0u) {
31 /* Each local invocation should see a unique value. Each value
32 * observed is tracked in "mask." The test automatically fails if a
33 * duplicate value is observed. The test passes once all 32 possible
34 * values have been observed.
39 /* This is an open-coded atomicAdd. */
42 } while ((f = atomicCompSwap(value, f, f + .5)) != a);
44 uint i = uint(f * 2.0);
49 /* If the bit was already set, the test fails. */
50 uint r = atomicOr(mask, m);
52 atomicCounterIncrement(fail);
54 /* Once all 32 bits are set, the test passes. */
55 if ((r | m) == 0xffffffffu)
56 atomicCounterIncrement(pass);
58 atomicCounterIncrement(fail);
65 probe atomic counter 0 == 24
66 probe atomic counter 1 == 0