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) 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
47 /* This is an open-coded atomicAdd. */
50 } while (f != atomicCompSwap(value, f, f + .5));
52 uint i = uint(f * 2.0);
57 if (c < mask.length()) {
58 /* If the bit was already set, the test fails. */
59 if ((atomicCounterOrARB(mask[c], m) & m) != 0u)
60 atomicCounterIncrement(fail);
62 color = vec4(0.0, 1.0, 0.0, 1.0);
64 color = vec4(0.0, 0.0, 1.0, 1.0);
72 ssbo 0 subdata float 0 0.0
74 clear color 0.5 0.5 0.5 0.5
79 probe atomic counter 0 == 4294967295
80 probe atomic counter 1 == 4294967295
81 probe atomic counter 2 == 4294967295
82 probe atomic counter 3 == 4294967295
83 probe atomic counter 4 == 4294967295
84 probe atomic counter 5 == 4294967295
85 probe atomic counter 6 == 4294967295
86 probe atomic counter 7 == 0