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