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) 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 3. */
39 v = atomicMin(value, 7u + local_index);
41 atomicCounterIncrement(fail);
44 atomicCounterIncrement(fail);
46 uint first_expected = (local_index + 1u) * 4u;
47 uint second_expected = local_index * 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 next array element.
52 v = atomicMin(array[local_index], second_expected);
53 if (v != first_expected)
54 atomicCounterIncrement(fail);
56 /* The per-instance value should give the new value on the second
57 * step. This is expected to be the byte offset of the current array
60 v = atomicExchange(array[local_index], first_expected);
61 if (v != second_expected)
62 atomicCounterIncrement(fail);
69 ssbo 0 subdata int 0 4
70 ssbo 0 subdata int 4 8
71 ssbo 0 subdata int 8 12
72 ssbo 0 subdata int 12 16
73 ssbo 0 subdata int 16 20
74 ssbo 0 subdata int 20 24
75 ssbo 0 subdata int 24 28
76 ssbo 0 subdata int 28 32
77 ssbo 0 subdata int 32 36
78 ssbo 0 subdata int 36 40
79 ssbo 0 subdata int 40 44
80 ssbo 0 subdata int 44 48
81 ssbo 0 subdata int 48 52
82 ssbo 0 subdata int 52 56
83 ssbo 0 subdata int 56 60
84 ssbo 0 subdata int 60 64
85 ssbo 0 subdata int 64 68
86 ssbo 0 subdata int 68 72
87 ssbo 0 subdata int 72 76
88 ssbo 0 subdata int 76 80
89 ssbo 0 subdata int 80 84
90 ssbo 0 subdata int 84 88
91 ssbo 0 subdata int 88 92
92 ssbo 0 subdata int 92 96
93 ssbo 0 subdata int 96 100
94 ssbo 0 subdata int 100 104
95 ssbo 0 subdata int 104 108
96 ssbo 0 subdata int 108 112
97 ssbo 0 subdata int 112 116
98 ssbo 0 subdata int 116 120
99 ssbo 0 subdata int 120 124
100 ssbo 0 subdata int 124 128
101 ssbo 0 subdata int 128 132
102 ssbo 0 subdata int 132 136
103 ssbo 0 subdata int 136 140
104 ssbo 0 subdata int 140 144
105 ssbo 0 subdata int 144 148
106 ssbo 0 subdata int 148 152
107 ssbo 0 subdata int 152 156
108 ssbo 0 subdata int 156 160
109 ssbo 0 subdata int 160 164
110 ssbo 0 subdata int 164 168
111 ssbo 0 subdata int 168 172
112 ssbo 0 subdata int 172 176
113 ssbo 0 subdata int 176 180
114 ssbo 0 subdata int 180 184
115 ssbo 0 subdata int 184 188
116 ssbo 0 subdata int 188 192
117 ssbo 0 subdata int 192 196
118 ssbo 0 subdata int 196 200
119 ssbo 0 subdata int 200 204
120 ssbo 0 subdata int 204 208
121 ssbo 0 subdata int 208 212
122 ssbo 0 subdata int 212 216
123 ssbo 0 subdata int 216 220
124 ssbo 0 subdata int 220 224
125 ssbo 0 subdata int 224 228
126 ssbo 0 subdata int 228 232
127 ssbo 0 subdata int 232 236
128 ssbo 0 subdata int 236 240
129 ssbo 0 subdata int 240 244
130 ssbo 0 subdata int 244 248
131 ssbo 0 subdata int 248 252
132 ssbo 0 subdata int 252 256
133 ssbo 0 subdata int 256 3
135 clear color 0.5 0.5 0.5 0.5
140 probe atomic counter 0 == 0