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