4 GL_ARB_shader_storage_buffer_object
5 GL_ARB_shader_atomic_counters
6 GL_ARB_shader_atomic_counter_ops
7 GL_INTEL_shader_atomic_float_minmax
9 [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_INTEL_shader_atomic_float_minmax: require
18 layout(binding = 0) buffer bufblock {
22 /* GL_ARB_shader_atomic_counters requires at least 8 total counters. */
23 layout(binding = 0) uniform atomic_uint mask[7];
24 layout(binding = 0) uniform atomic_uint fail;
28 const uint max_index = uint(mask.length()) * 32u + 31u;
32 uint x = uint(gl_FragCoord.x);
33 uint y = uint(gl_FragCoord.y);
34 uint local_index = y * 32u + x;
36 float new_value = (x < 32u && y < uint(mask.length()))
37 ? 0.5 * float(local_index) : 3e10;
39 float f = atomicExchange(value, new_value);
40 uint i = uint(f * 2.);
46 /* If the bit was already set, the test fails. */
47 uint r = atomicCounterOrARB(mask[c], m);
49 atomicCounterIncrement(fail);
51 if (bit == local_index)
52 atomicCounterIncrement(fail);
54 color = vec4(0.0, 1.0, 0.0, 1.0);
56 color = vec4(0.0, 0.0, 1.0, 1.0);
64 ssbo 0 subdata float 0 3e10
66 clear color 0.5 0.5 0.5 0.5
71 probe atomic counter 0 == 4294967295
72 probe atomic counter 1 == 4294967295
73 probe atomic counter 2 == 4294967295
74 probe atomic counter 3 == 4294967295
75 probe atomic counter 4 == 4294967295
76 probe atomic counter 5 == 4294967295
77 probe atomic counter 6 == 4294967295
78 probe atomic counter 7 == 0