4 GL_ARB_shader_storage_buffer_object
5 GL_ARB_shader_atomic_counters
7 [vertex shader passthrough]
11 #extension GL_ARB_shader_storage_buffer_object: require
12 #extension GL_ARB_shader_atomic_counters: require
14 layout(binding = 0) buffer bufblock {
19 layout(binding = 0) uniform atomic_uint fail;
25 uint x = uint(gl_FragCoord.x);
26 uint y = uint(gl_FragCoord.y);
27 uint local_index = y * uint(array.length()) + x;
30 /* For value, every instance should get 3. */
31 v = atomicMin(value, 7u + local_index);
33 atomicCounterIncrement(fail);
36 atomicCounterIncrement(fail);
38 if (local_index < uint(array.length())) {
39 uint first_expected = (local_index + 1u) * 4u;
40 uint second_expected = local_index * 4u;
42 /* The per-instance value should give the old value on the
43 * first step. This is expected to be the byte offset of the
46 v = atomicMin(array[local_index], second_expected);
47 if (v != first_expected)
48 atomicCounterIncrement(fail);
50 /* The per-instance value should give the new value on the
51 * second step. This is expected to be the byte offset of the
52 * current array element.
54 v = atomicExchange(array[local_index], first_expected);
55 if (v != second_expected)
56 atomicCounterIncrement(fail);
58 color = vec4(0.0, 1.0, 0.0, 1.0);
60 color = vec4(0.0, 0.0, 1.0, 1.0);
68 ssbo 0 subdata int 0 4
69 ssbo 0 subdata int 4 8
70 ssbo 0 subdata int 8 12
71 ssbo 0 subdata int 12 16
72 ssbo 0 subdata int 16 20
73 ssbo 0 subdata int 20 24
74 ssbo 0 subdata int 24 28
75 ssbo 0 subdata int 28 32
76 ssbo 0 subdata int 32 36
77 ssbo 0 subdata int 36 40
78 ssbo 0 subdata int 40 44
79 ssbo 0 subdata int 44 48
80 ssbo 0 subdata int 48 52
81 ssbo 0 subdata int 52 56
82 ssbo 0 subdata int 56 60
83 ssbo 0 subdata int 60 64
84 ssbo 0 subdata int 64 68
85 ssbo 0 subdata int 68 72
86 ssbo 0 subdata int 72 76
87 ssbo 0 subdata int 76 80
88 ssbo 0 subdata int 80 84
89 ssbo 0 subdata int 84 88
90 ssbo 0 subdata int 88 92
91 ssbo 0 subdata int 92 96
92 ssbo 0 subdata int 96 100
93 ssbo 0 subdata int 100 104
94 ssbo 0 subdata int 104 108
95 ssbo 0 subdata int 108 112
96 ssbo 0 subdata int 112 116
97 ssbo 0 subdata int 116 120
98 ssbo 0 subdata int 120 124
99 ssbo 0 subdata int 124 128
100 ssbo 0 subdata int 128 132
101 ssbo 0 subdata int 132 136
102 ssbo 0 subdata int 136 140
103 ssbo 0 subdata int 140 144
104 ssbo 0 subdata int 144 148
105 ssbo 0 subdata int 148 152
106 ssbo 0 subdata int 152 156
107 ssbo 0 subdata int 156 160
108 ssbo 0 subdata int 160 164
109 ssbo 0 subdata int 164 168
110 ssbo 0 subdata int 168 172
111 ssbo 0 subdata int 172 176
112 ssbo 0 subdata int 176 180
113 ssbo 0 subdata int 180 184
114 ssbo 0 subdata int 184 188
115 ssbo 0 subdata int 188 192
116 ssbo 0 subdata int 192 196
117 ssbo 0 subdata int 196 200
118 ssbo 0 subdata int 200 204
119 ssbo 0 subdata int 204 208
120 ssbo 0 subdata int 208 212
121 ssbo 0 subdata int 212 216
122 ssbo 0 subdata int 216 220
123 ssbo 0 subdata int 220 224
124 ssbo 0 subdata int 224 228
125 ssbo 0 subdata int 228 232
126 ssbo 0 subdata int 232 236
127 ssbo 0 subdata int 236 240
128 ssbo 0 subdata int 240 244
129 ssbo 0 subdata int 244 248
130 ssbo 0 subdata int 248 252
131 ssbo 0 subdata int 252 256
132 ssbo 0 subdata int 256 3
134 clear color 0.5 0.5 0.5 0.5
139 probe atomic counter 0 == 0