5 GL_ARB_shader_storage_buffer_object
6 GL_ARB_shader_atomic_counters
10 #extension GL_ARB_compute_shader: require
11 #extension GL_ARB_shader_storage_buffer_object: require
12 #extension GL_ARB_shader_atomic_counters: require
14 layout(local_size_x = 64) in;
16 layout(binding = 0, std430) buffer bufblock {
17 uint source_array[64];
21 shared uint array[source_array.length()];
24 layout(binding = 0) uniform atomic_uint fail;
28 if (gl_LocalInvocationIndex == 0u) {
35 uint local_index = gl_LocalInvocationIndex;
38 /* For value, every instance should get 2147483647. */
39 v = atomicMax(value, local_index);
41 atomicCounterIncrement(fail);
43 if (value != 2147483647u)
44 atomicCounterIncrement(fail);
46 uint first_expected = local_index * 4u;
47 uint second_expected = (local_index + 1u) * 4u;
49 /* The per-instance value should give the old value on the first step.
50 * This is expected to be the byte offset of the current array
53 v = atomicMax(array[local_index], second_expected);
54 if (v != first_expected)
55 atomicCounterIncrement(fail);
57 /* The per-instance value should give the new value on the second
58 * step. This is expected to be the byte offset of the next array
61 v = atomicExchange(array[local_index], first_expected);
62 if (v != second_expected)
63 atomicCounterIncrement(fail);
70 ssbo 0 subdata int 0 0
71 ssbo 0 subdata int 4 4
72 ssbo 0 subdata int 8 8
73 ssbo 0 subdata int 12 12
74 ssbo 0 subdata int 16 16
75 ssbo 0 subdata int 20 20
76 ssbo 0 subdata int 24 24
77 ssbo 0 subdata int 28 28
78 ssbo 0 subdata int 32 32
79 ssbo 0 subdata int 36 36
80 ssbo 0 subdata int 40 40
81 ssbo 0 subdata int 44 44
82 ssbo 0 subdata int 48 48
83 ssbo 0 subdata int 52 52
84 ssbo 0 subdata int 56 56
85 ssbo 0 subdata int 60 60
86 ssbo 0 subdata int 64 64
87 ssbo 0 subdata int 68 68
88 ssbo 0 subdata int 72 72
89 ssbo 0 subdata int 76 76
90 ssbo 0 subdata int 80 80
91 ssbo 0 subdata int 84 84
92 ssbo 0 subdata int 88 88
93 ssbo 0 subdata int 92 92
94 ssbo 0 subdata int 96 96
95 ssbo 0 subdata int 100 100
96 ssbo 0 subdata int 104 104
97 ssbo 0 subdata int 108 108
98 ssbo 0 subdata int 112 112
99 ssbo 0 subdata int 116 116
100 ssbo 0 subdata int 120 120
101 ssbo 0 subdata int 124 124
102 ssbo 0 subdata int 128 128
103 ssbo 0 subdata int 132 132
104 ssbo 0 subdata int 136 136
105 ssbo 0 subdata int 140 140
106 ssbo 0 subdata int 144 144
107 ssbo 0 subdata int 148 148
108 ssbo 0 subdata int 152 152
109 ssbo 0 subdata int 156 156
110 ssbo 0 subdata int 160 160
111 ssbo 0 subdata int 164 164
112 ssbo 0 subdata int 168 168
113 ssbo 0 subdata int 172 172
114 ssbo 0 subdata int 176 176
115 ssbo 0 subdata int 180 180
116 ssbo 0 subdata int 184 184
117 ssbo 0 subdata int 188 188
118 ssbo 0 subdata int 192 192
119 ssbo 0 subdata int 196 196
120 ssbo 0 subdata int 200 200
121 ssbo 0 subdata int 204 204
122 ssbo 0 subdata int 208 208
123 ssbo 0 subdata int 212 212
124 ssbo 0 subdata int 216 216
125 ssbo 0 subdata int 220 220
126 ssbo 0 subdata int 224 224
127 ssbo 0 subdata int 228 228
128 ssbo 0 subdata int 232 232
129 ssbo 0 subdata int 236 236
130 ssbo 0 subdata int 240 240
131 ssbo 0 subdata int 244 244
132 ssbo 0 subdata int 248 248
133 ssbo 0 subdata int 252 252
134 ssbo 0 subdata int 256 2147483647
137 probe atomic counter 0 == 0