104 layout(local_size_x = 32) in;
116 layout(binding = 2, std430) writeonly
buffer BlockSumData
145 dot(in_points[4u * index + 0u].xyz, axis),
146 dot(in_points[4u * index + 1u].xyz, axis),
147 dot(in_points[4u * index + 2u].xyz, axis),
148 dot(in_points[4u * index + 3u].xyz, axis));
149 z = 65535.0 *
clamp((z - zMin) / (zMax - zMin),
vec4(0.0),
vec4(1.0));
150 return bitfieldExtract(uvec4(z), bitOffset, 2);
161 flags[ident] = flagdata;
164 uvec4 miniblock0 = uvec4(equal(flagdata.xxxx, uvec4(0u, 1u, 2u, 3u)));
165 uvec4 miniblock1 = uvec4(equal(flagdata.yyyy, uvec4(0u, 1u, 2u, 3u)));
166 uvec4 miniblock2 = uvec4(equal(flagdata.zzzz, uvec4(0u, 1u, 2u, 3u)));
167 uvec4 miniblock3 = uvec4(equal(flagdata.wwww, uvec4(0u, 1u, 2u, 3u)));
170 miniblock1 += miniblock0;
171 miniblock2 += miniblock1;
172 miniblock3 += miniblock2;
178 sharedData[local_ident] = miniblock3;
179 memoryBarrierShared();
182 for (uint step = 0u; step <
NUM_STEPS; step++) {
185 if ((local_ident & (1u << step)) != 0u) {
187 uint prev = ((local_ident >> step) << step) - 1u;
190 uvec4 sum_prev = sharedData[prev];
191 miniblock0 += sum_prev;
192 miniblock1 += sum_prev;
193 miniblock2 += sum_prev;
194 miniblock3 += sum_prev;
197 sharedData[local_ident] = miniblock3;
199 memoryBarrierShared();
204 if ((local_ident & (1u << NUM_STEPS)) != 0u) {
206 uint prev = ((local_ident >>
NUM_STEPS) << NUM_STEPS) - 1u;
209 uvec4 sum_prev = sharedData[prev];
210 miniblock0 += sum_prev;
211 miniblock1 += sum_prev;
212 miniblock2 += sum_prev;
213 miniblock3 += sum_prev;
217 outbuf[4u * ident + 0u] = miniblock0;
218 outbuf[4u * ident + 1u] = miniblock1;
219 outbuf[4u * ident + 2u] = miniblock2;
220 outbuf[4u * ident + 3u] = miniblock3;
223 if (local_ident == (gl_WorkGroupSize.x - 1u))
224 blocksum[gl_WorkGroupID.x] = miniblock3;
float clamp(float x, float min, float max)
shared uvec4 sharedData[gl_WorkGroupSize.x]
layout(local_size_x=32) in
void uniform(string name, const mat4 &v)
GLint GLint GLint GLint GLint x
uvec4 decodeKeys(uint index)