4 GL_ARB_shader_storage_buffer_object
5 GL_ARB_shader_atomic_counters
6 GL_ARB_shader_atomic_counter_ops
8 GL_INTEL_shader_atomic_float_minmax
10 [vertex shader passthrough]
13 #extension GL_ARB_shader_storage_buffer_object: require
14 #extension GL_ARB_shader_atomic_counters: require
15 #extension GL_ARB_shader_atomic_counter_ops: require
16 #extension GL_ARB_gpu_shader5: require
17 #extension GL_INTEL_shader_atomic_float_minmax: require
19 layout(binding = 0, std430) buffer bufblock {
23 /* GL_ARB_shader_atomic_counters requires at least 8 total counters. */
24 layout(binding = 0) uniform atomic_uint mask[7];
25 layout(binding = 0) uniform atomic_uint fail;
31 /* According to issue #22 of the GL_ARB_shader_image_load_store, the
32 * return result of atomic operations in helper invocations is
33 * undefined. To avoid a possible infinite loop (below) in a helper
34 * invocation, bail out now.
36 if (gl_SampleMaskIn[0] == 0)
39 /* Each of 32 * N fragments should see a unique value. Each value
40 * observed is tracked in "mask." The test automatically fails if a
41 * duplicate value is observed. After the shaders are done running,
42 * the mask values will be probed to ensure that all possible values
49 /* This is an open-coded atomicAdd. */
56 /* Stop when values won't fit in the mask array. */
57 if (c >= mask.length()) {
58 color = vec4(0.0, 0.0, 1.0, 1.0);
61 } while (f != atomicCompSwap(value, f, f + .5));
66 /* If the bit was already set, the test fails. */
67 if ((atomicCounterOrARB(mask[c], m) & m) != 0u)
68 atomicCounterIncrement(fail);
70 color = vec4(0.0, 1.0, 0.0, 1.0);
77 ssbo 0 subdata float 0 0.0
79 clear color 0.5 0.5 0.5 0.5
84 probe atomic counter 0 == 4294967295
85 probe atomic counter 1 == 4294967295
86 probe atomic counter 2 == 4294967295
87 probe atomic counter 3 == 4294967295
88 probe atomic counter 4 == 4294967295
89 probe atomic counter 5 == 4294967295
90 probe atomic counter 6 == 4294967295
91 probe atomic counter 7 == 0