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 2147483647. */
31 v = atomicMax(value, local_index);
33 atomicCounterIncrement(fail);
35 if (value != 2147483647u)
36 atomicCounterIncrement(fail);
38 if (local_index < uint(array.length())) {
39 uint first_expected = local_index * 4u;
40 uint second_expected = (local_index + 1u) * 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
44 * current array element.
46 v = atomicMax(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
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 0
69 ssbo 0 subdata int 4 4
70 ssbo 0 subdata int 8 8
71 ssbo 0 subdata int 12 12
72 ssbo 0 subdata int 16 16
73 ssbo 0 subdata int 20 20
74 ssbo 0 subdata int 24 24
75 ssbo 0 subdata int 28 28
76 ssbo 0 subdata int 32 32
77 ssbo 0 subdata int 36 36
78 ssbo 0 subdata int 40 40
79 ssbo 0 subdata int 44 44
80 ssbo 0 subdata int 48 48
81 ssbo 0 subdata int 52 52
82 ssbo 0 subdata int 56 56
83 ssbo 0 subdata int 60 60
84 ssbo 0 subdata int 64 64
85 ssbo 0 subdata int 68 68
86 ssbo 0 subdata int 72 72
87 ssbo 0 subdata int 76 76
88 ssbo 0 subdata int 80 80
89 ssbo 0 subdata int 84 84
90 ssbo 0 subdata int 88 88
91 ssbo 0 subdata int 92 92
92 ssbo 0 subdata int 96 96
93 ssbo 0 subdata int 100 100
94 ssbo 0 subdata int 104 104
95 ssbo 0 subdata int 108 108
96 ssbo 0 subdata int 112 112
97 ssbo 0 subdata int 116 116
98 ssbo 0 subdata int 120 120
99 ssbo 0 subdata int 124 124
100 ssbo 0 subdata int 128 128
101 ssbo 0 subdata int 132 132
102 ssbo 0 subdata int 136 136
103 ssbo 0 subdata int 140 140
104 ssbo 0 subdata int 144 144
105 ssbo 0 subdata int 148 148
106 ssbo 0 subdata int 152 152
107 ssbo 0 subdata int 156 156
108 ssbo 0 subdata int 160 160
109 ssbo 0 subdata int 164 164
110 ssbo 0 subdata int 168 168
111 ssbo 0 subdata int 172 172
112 ssbo 0 subdata int 176 176
113 ssbo 0 subdata int 180 180
114 ssbo 0 subdata int 184 184
115 ssbo 0 subdata int 188 188
116 ssbo 0 subdata int 192 192
117 ssbo 0 subdata int 196 196
118 ssbo 0 subdata int 200 200
119 ssbo 0 subdata int 204 204
120 ssbo 0 subdata int 208 208
121 ssbo 0 subdata int 212 212
122 ssbo 0 subdata int 216 216
123 ssbo 0 subdata int 220 220
124 ssbo 0 subdata int 224 224
125 ssbo 0 subdata int 228 228
126 ssbo 0 subdata int 232 232
127 ssbo 0 subdata int 236 236
128 ssbo 0 subdata int 240 240
129 ssbo 0 subdata int 244 244
130 ssbo 0 subdata int 248 248
131 ssbo 0 subdata int 252 252
132 ssbo 0 subdata int 256 2147483647
134 clear color 0.5 0.5 0.5 0.5
139 probe atomic counter 0 == 0