4 GL_ARB_shader_storage_buffer_object
5 GL_ARB_shader_atomic_counters
6 GL_ARB_shader_atomic_counter_ops
8 [vertex shader passthrough]
12 #extension GL_ARB_shader_storage_buffer_object: require
13 #extension GL_ARB_shader_atomic_counters: require
14 #extension GL_ARB_shader_atomic_counter_ops: require
16 layout(binding = 0) buffer bufblock {
20 /* GL_ARB_shader_atomic_counters requires at least 8 total counters. */
21 layout(binding = 0) uniform atomic_uint mask[7];
22 layout(binding = 0) uniform atomic_uint fail;
26 const uint max_index = uint(mask.length()) * 32u + 31u;
30 uint x = uint(gl_FragCoord.x);
31 uint y = uint(gl_FragCoord.y);
32 uint local_index = y * 32u + x;
34 int new_value = (x < 32u && y < uint(mask.length()))
35 ? int(4u * local_index) : 0x7fffffff;
37 int f = atomicExchange(value, new_value);
38 uint i = uint(f) / 4u;
44 /* If the bit was already set, the test fails. */
45 uint r = atomicCounterOrARB(mask[c], m);
47 atomicCounterIncrement(fail);
49 if (bit == local_index)
50 atomicCounterIncrement(fail);
52 color = vec4(0.0, 1.0, 0.0, 1.0);
54 color = vec4(0.0, 0.0, 1.0, 1.0);
62 ssbo 0 subdata int 0 65536
64 clear color 0.5 0.5 0.5 0.5
69 probe atomic counter 0 == 4294967295
70 probe atomic counter 1 == 4294967295
71 probe atomic counter 2 == 4294967295
72 probe atomic counter 3 == 4294967295
73 probe atomic counter 4 == 4294967295
74 probe atomic counter 5 == 4294967295
75 probe atomic counter 6 == 4294967295
76 probe atomic counter 7 == 0