easycomponentstools 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,784 @@
1
+ import { l as e } from "./get-attribute-from-layouts-CW53R-qj.js";
2
+ import { n as t, t as n } from "./buffer-transform-9D2EHz6U.js";
3
+ import { _ as r, a as i, n as a, r as o, t as s, v as c } from "./expression-DyJkfNa7.js";
4
+ //#region node_modules/@luma.gl/gpgpu/dist/operations/webgl/common/helper.js
5
+ function l(e, t, n = !1) {
6
+ if (n) return t === 1 ? "float" : `vec${t}`;
7
+ switch (e) {
8
+ case "uint8":
9
+ case "uint16":
10
+ case "uint32": return t === 1 ? "uint" : `uvec${t}`;
11
+ case "sint8":
12
+ case "sint16":
13
+ case "sint32": return t === 1 ? "int" : `ivec${t}`;
14
+ default: return t === 1 ? "float" : `vec${t}`;
15
+ }
16
+ }
17
+ function u(e, t, n = !1) {
18
+ let r;
19
+ if (n) switch (e) {
20
+ case "uint8":
21
+ r = "unorm8";
22
+ break;
23
+ case "sint8":
24
+ r = "snorm8";
25
+ break;
26
+ case "uint16":
27
+ r = "unorm16";
28
+ break;
29
+ case "sint16":
30
+ r = "snorm16";
31
+ break;
32
+ case "float32":
33
+ r = "float32";
34
+ break;
35
+ default: throw Error(`Unsupported normalized vertex format for ${e}`);
36
+ }
37
+ else r = e;
38
+ return t === 1 ? r : t === 3 && !r.startsWith("float32") && !r.endsWith("32") ? `${r}x3-webgl` : `${r}x${t}`;
39
+ }
40
+ function d(e) {
41
+ switch (e[0]) {
42
+ case "u": return "0u";
43
+ case "s": return "0";
44
+ default: return "0.";
45
+ }
46
+ }
47
+ function f(e, t) {
48
+ switch (e) {
49
+ case "uint8":
50
+ case "uint16":
51
+ case "uint32": return `${Math.trunc(t)}u`;
52
+ case "sint8":
53
+ case "sint16":
54
+ case "sint32": return `${Math.trunc(t)}`;
55
+ default: return Number.isInteger(t) ? `${t}.0` : `${t}`;
56
+ }
57
+ }
58
+ function p(e) {
59
+ switch (e) {
60
+ case "uint8": return "r8uint";
61
+ case "sint8": return "r8sint";
62
+ case "uint16": return "r16uint";
63
+ case "sint16": return "r16sint";
64
+ case "uint32": return "r32uint";
65
+ case "sint32": return "r32sint";
66
+ case "float32": return "r32float";
67
+ default: throw Error(`Unsupported WebGL gather texture format for ${e}`);
68
+ }
69
+ }
70
+ function m(e) {
71
+ return e;
72
+ }
73
+ function h(e) {
74
+ switch (e) {
75
+ case "uint32": return "usampler2D";
76
+ case "sint32": return "isampler2D";
77
+ case "float32": return "sampler2D";
78
+ default: throw Error(`Unsupported WebGL gather sampler type for ${e}`);
79
+ }
80
+ }
81
+ //#endregion
82
+ //#region node_modules/@luma.gl/gpgpu/dist/operations/webgl/common/row-transform.js
83
+ var g = "GPGPU Operation Counts", _ = "Transform Runs", v = new c();
84
+ function y({ module: e, elementWise: t = !1, expression: r, inputs: a, output: s, operationType: c = s.type, outputBuffer: u }) {
85
+ let f = u.device, p = C("result", s.type, s.size, s.normalized), m = [e, p], h = [], y = {}, w = l(s.type, 1, s.normalized), T = l(c, 1, s.normalized), E = "", D = null, O = {
86
+ TYPE: T,
87
+ RESULT_LEN: s.size.toString()
88
+ }, k = b(a);
89
+ for (let [e, t] of k) m.push(x(e, t.type, t.size, t.normalized, c)), h.push(S(e, t)), t instanceof o ? y[e] = t.buffer : (D ||= i.createOrReuse(f, u.byteLength), y[e] = D), E += `TYPE ${e}[${t.size}]; get_${e}(${e});\n`, O[`${e.toUpperCase()}_LEN`] = t.size.toString();
90
+ let A = "";
91
+ if (r) for (let e = 0; e < s.size; e++) A += `result[${e}]=${r(e)};\n`;
92
+ else if (t) for (let t = 0; t < s.size; t++) {
93
+ let n = d(T), r = k.map(([e, r]) => t < r.size ? `${e}[${t}]` : n);
94
+ A += `result[${t}]=${e.name}(${r.join(", ")});\n`;
95
+ }
96
+ else A = `${e.name}(${k.map(([e]) => e).join(", ")}, result);`;
97
+ let j = `\
98
+ #version 300 es
99
+
100
+ void main() {
101
+ ${E}
102
+ ${w} result[${s.size}];
103
+ ${A}
104
+ set_result(result);
105
+ }
106
+ `, M = new n(f, {
107
+ vs: j,
108
+ shaderAssembler: v,
109
+ defines: O,
110
+ modules: m,
111
+ bufferLayout: h,
112
+ vertexCount: 1,
113
+ instanceCount: s.length,
114
+ attributes: y,
115
+ feedbackBufferMode: "interleaved",
116
+ outputs: p.varyings
117
+ });
118
+ f.statsManager.getStats(g).get(_).incrementCount(), M.run({
119
+ inputBuffers: y,
120
+ outputBuffers: { [p.varyings[0]]: s.offset === 0 ? u : {
121
+ buffer: u,
122
+ byteOffset: s.offset,
123
+ byteLength: s.byteLength
124
+ } }
125
+ }), D && i.recycle(D);
126
+ }
127
+ function b(e) {
128
+ return Array.isArray(e) ? e.map((e, t) => [`x${t}`, e]) : Object.entries(e);
129
+ }
130
+ function x(e, t, n, r = !1, i = t) {
131
+ let a = "", o = "";
132
+ for (let s = 0; s < n; s += 4) {
133
+ let c = Math.min(n - s, 4), u = l(t, c, r);
134
+ a += `in ${u} a${e}_${s};\n`;
135
+ for (let n = 0; n < c; n++) {
136
+ let a = `a${e}_${s}`;
137
+ c > 1 && (a = `${a}[${n}]`), (r || t !== i) && (a = `TYPE(${a})`), o += `v[${s + n}]=${a};\n`;
138
+ }
139
+ }
140
+ return {
141
+ name: e,
142
+ vs: `
143
+ ${a}
144
+ void get_${e}(out TYPE v[${n}]) {
145
+ ${o}
146
+ }
147
+ `
148
+ };
149
+ }
150
+ function S(e, t) {
151
+ let n = {
152
+ name: e,
153
+ stepMode: t.isConstant ? "vertex" : "instance",
154
+ byteStride: t.stride,
155
+ attributes: []
156
+ };
157
+ for (let r = 0; r < t.size; r += 4) {
158
+ let i = Math.min(t.size - r, 4);
159
+ n.attributes.push({
160
+ attribute: `a${e}_${r}`,
161
+ format: u(t.type, i, t.normalized),
162
+ byteOffset: t.offset + t.ValueType.BYTES_PER_ELEMENT * r
163
+ });
164
+ }
165
+ return n;
166
+ }
167
+ function C(e, t, n, r = !1) {
168
+ let i = [], a = l(t, 1, r), o = "", s = "";
169
+ for (let a = 0; a < n; a += 4) {
170
+ let c = Math.min(n - a, 4), u = l(t, c, r);
171
+ i.push(`${e}_${a}`), o += `flat out ${u} ${e}_${a};\n`;
172
+ let d = Array.from({ length: c }, (e, t) => a + t);
173
+ s += `${e}_${a} = ${u}(${d.map((e) => `v[${e}]`).join(",")});\n`;
174
+ }
175
+ return {
176
+ name: e,
177
+ varyings: i,
178
+ vs: `
179
+ ${o}
180
+ void set_${e}(in ${a} v[${n}]) {
181
+ ${s}
182
+ }
183
+ `
184
+ };
185
+ }
186
+ //#endregion
187
+ //#region node_modules/@luma.gl/gpgpu/dist/operations/webgl/arithmetic.js
188
+ var w = "TYPE arithmetic_add(TYPE x, TYPE y) {\n return x + y;\n}\n\nTYPE arithmetic_subtract(TYPE x, TYPE y) {\n return x - y;\n}\n\nTYPE arithmetic_multiply(TYPE x, TYPE y) {\n return x * y;\n}\n\nTYPE arithmetic_divide(TYPE x, TYPE y) {\n return x / y;\n}\n\nfloat arithmetic_tan(float x) {\n return tan_fp32(x);\n}\n", T = ({ inputs: e, output: t, target: n }) => {
189
+ let i = t.type, o = l(i, 1, t.normalized), c = d(o), u = e.namedInputs;
190
+ return y({
191
+ module: {
192
+ name: "arithmetic",
193
+ dependencies: [r],
194
+ vs: w
195
+ },
196
+ inputs: u,
197
+ output: t,
198
+ operationType: i,
199
+ outputBuffer: n,
200
+ expression: (t) => s(e.expression, {
201
+ operations: a,
202
+ inputs: u,
203
+ laneIndex: t,
204
+ formatInput: (e) => `${e}[${t}]`,
205
+ formatOutOfBoundsInput: (e) => u[e].size === 1 ? `${e}[0]` : c,
206
+ formatLiteral: (e) => {
207
+ let n = Array.isArray(e) ? e[t] ?? 0 : e;
208
+ return `${o}(${f(i, n)})`;
209
+ },
210
+ formatCall: (e, t) => `${e}(${t.join(", ")})`
211
+ })
212
+ }), { success: !0 };
213
+ }, E = "GPGPU Operation Counts", D = "Transform Runs", O = ({ inputs: n, output: r, target: a }) => {
214
+ let { sourceValues: s } = n, c = a.device;
215
+ if (s.length === 0) {
216
+ let e = new r.ValueType(r.length * r.size);
217
+ return a.write(e), {
218
+ success: !0,
219
+ value: e
220
+ };
221
+ }
222
+ if (s.isConstant) {
223
+ let e = s.value, t = new r.ValueType(r.length * r.size);
224
+ for (let n = 0; n < r.length; n++) {
225
+ let r = e[n];
226
+ t[n * 2] = r, t[n * 2 + 1] = r;
227
+ }
228
+ return a.write(t), {
229
+ success: !0,
230
+ value: t
231
+ };
232
+ }
233
+ let l = c.createTexture({
234
+ width: 1,
235
+ height: r.length,
236
+ format: "rg32float",
237
+ usage: e.RENDER | e.COPY_SRC | e.COPY_DST
238
+ }), u = c.createFramebuffer({ colorAttachments: [l] }), d = new t(c, {
239
+ vs: "#version 300 es\n\nflat out float extent_value;\n\nvoid main() {\n float sourceValues[SOURCE_VALUES_LEN];\n get_sourceValues(sourceValues);\n extent_value = sourceValues[gl_VertexID];\n\n float y = (float(gl_VertexID) + 0.5) / float(CHANNEL_COUNT) * 2.0 - 1.0;\n gl_Position = vec4(0.0, y, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n ",
240
+ fs: "#version 300 es\n\nprecision highp float;\n\nflat in float extent_value;\nout vec2 fragColor;\n\nvoid main() {\n fragColor = vec2(-extent_value, extent_value);\n}\n ",
241
+ topology: "point-list",
242
+ parameters: {
243
+ depthCompare: "always",
244
+ blend: !0,
245
+ blendColorSrcFactor: "one",
246
+ blendColorDstFactor: "one",
247
+ blendColorOperation: "max",
248
+ blendAlphaSrcFactor: "one",
249
+ blendAlphaDstFactor: "one",
250
+ blendAlphaOperation: "max"
251
+ },
252
+ modules: [x("sourceValues", s.type, s.size, s.normalized)],
253
+ defines: {
254
+ TYPE: "float",
255
+ SOURCE_VALUES_LEN: s.size.toString(),
256
+ CHANNEL_COUNT: r.length.toString()
257
+ },
258
+ attributes: { sourceValues: s.buffer },
259
+ bufferLayout: [S("sourceValues", s)],
260
+ instanceCount: s.length,
261
+ vertexCount: r.length,
262
+ disableWarnings: !0
263
+ }), f = i.createOrReuse(c, r.byteLength);
264
+ try {
265
+ let e = c.beginRenderPass({
266
+ framebuffer: u,
267
+ parameters: { viewport: [
268
+ 0,
269
+ 0,
270
+ 1,
271
+ r.length
272
+ ] },
273
+ clearColor: [
274
+ -k,
275
+ -k,
276
+ 0,
277
+ 0
278
+ ],
279
+ clearDepth: !1,
280
+ clearStencil: !1
281
+ });
282
+ c.statsManager.getStats(E).get(D).incrementCount(), d.draw(e), e.end();
283
+ let t = c.createCommandEncoder();
284
+ return t.copyTextureToBuffer({
285
+ sourceTexture: l,
286
+ width: 1,
287
+ height: r.length,
288
+ destinationBuffer: f,
289
+ byteOffset: 0,
290
+ bytesPerRow: 8
291
+ }), c.submit(t.finish()), T({
292
+ device: c,
293
+ inputs: {
294
+ expression: {
295
+ kind: "call",
296
+ op: "multiply",
297
+ args: [{
298
+ kind: "input",
299
+ name: "x"
300
+ }, {
301
+ kind: "literal",
302
+ value: [-1, 1]
303
+ }]
304
+ },
305
+ namedInputs: { x: new o({
306
+ buffer: f,
307
+ size: 2,
308
+ type: "float32",
309
+ length: r.length
310
+ }) }
311
+ },
312
+ output: r,
313
+ target: a
314
+ });
315
+ } finally {
316
+ d.destroy(), i.recycle(f), u.destroy(), l.destroy();
317
+ }
318
+ }, k = 3e38, A = ({ inputs: e, output: t, target: n }) => {
319
+ let r = e.map((e, t) => [`x${t}`, e]);
320
+ j(n.device.limits.maxVertexAttributes, r), M(n.device.limits.maxInterStageShaderVariables, t);
321
+ let i = r.map(([e, t]) => `in TYPE ${e}[${t.size}]`).join(", "), a = 0;
322
+ return y({
323
+ module: {
324
+ name: "interleave",
325
+ vs: `\
326
+ void interleave(${i}, out TYPE result[RESULT_LEN]) {
327
+ ${r.map(([e, t]) => {
328
+ let n = Array.from({ length: t.size }, (t, n) => ` result[${a + n}] = ${e}[${n}];`).join("\n");
329
+ return a += t.size, n;
330
+ }).join("\n")}
331
+ }
332
+ `
333
+ },
334
+ inputs: e,
335
+ output: t,
336
+ outputBuffer: n
337
+ }), { success: !0 };
338
+ };
339
+ function j(e, t) {
340
+ let n = t.reduce((e, [, t]) => e + Math.ceil(t.size / 4), 0);
341
+ if (n > e) throw Error(`interleave() requires ${n} vertex attributes, exceeding device limit ${e}`);
342
+ }
343
+ function M(e, t) {
344
+ if (t.size > e) throw Error(`interleave() output size ${t.size} exceeds device inter-stage component limit ${e}`);
345
+ }
346
+ //#endregion
347
+ //#region node_modules/@luma.gl/gpgpu/dist/operations/webgl/fround.js
348
+ function N() {
349
+ let e = new Uint16Array([255]);
350
+ return new Uint8Array(e.buffer)[0] > 0;
351
+ }
352
+ var P = `\
353
+ #define LE ${+!!N()}
354
+ const uint F32_NAN = 0xffffffffu;
355
+ const uint F32_INF = 0x7f800000u;
356
+
357
+ // Find first set bit using binary search
358
+ // https://en.wikipedia.org/wiki/Find_first_set#CLZ
359
+ int countLeadingZeros(uint a) {
360
+ if (a == 0u) return 32;
361
+ int n = 0;
362
+ if ((a & 0xffff0000u) == 0u) { n += 16; a = a << 16; }
363
+ if ((a & 0xff000000u) == 0u) { n += 8; a = a << 8; }
364
+ if ((a & 0xf0000000u) == 0u) { n += 4; a = a << 4; }
365
+ if ((a & 0xc0000000u) == 0u) { n += 2; a = a << 2; }
366
+ if ((a & 0x80000000u) == 0u) return n + 1;
367
+ return n;
368
+ }
369
+
370
+ uint roundShiftRight(uint value, int shift) {
371
+ if (shift <= 0) {
372
+ return value << (-shift);
373
+ }
374
+
375
+ if (shift >= 32) {
376
+ if (shift == 32 && value > 0x80000000u) {
377
+ return 1u;
378
+ }
379
+ return 0u;
380
+ }
381
+
382
+ uint truncated = value >> shift;
383
+ uint halfShift = 1u << (shift - 1);
384
+ uint remainder = value & ((1u << shift) - 1u);
385
+ if (remainder > halfShift || (remainder == halfShift && (truncated & 1u) == 1u)) {
386
+ return truncated + 1u;
387
+ }
388
+ return truncated;
389
+ }
390
+
391
+ uint makeFloat_(uint sign, int exponent, uint mantissa) {
392
+ return (sign << 31) | (uint(exponent + 127) << 23) | (mantissa & 0x7fffffu);
393
+ }
394
+
395
+ /**
396
+ * Assemble a float32 in bit representation according to IEEE 754
397
+ * https://en.wikipedia.org/wiki/Single-precision_floating-point_format
398
+ */
399
+ uint makeFloat(uint sign, int exponent, uint significand) {
400
+ if (significand == 0u) {
401
+ return sign << 31;
402
+ }
403
+
404
+ // Remove any extra leading zeros for better precision
405
+ int lead_zeros = countLeadingZeros(significand);
406
+ // Significand is encoded as 1.fraction
407
+ int normalizedExponent = exponent + 31 - lead_zeros;
408
+
409
+ if (normalizedExponent > 127) {
410
+ return (sign << 31) | F32_INF;
411
+ }
412
+
413
+ uint mantissa;
414
+ if (normalizedExponent >= -126) {
415
+ mantissa = roundShiftRight(significand, 8 - lead_zeros);
416
+ if (mantissa >= 0x1000000u) {
417
+ mantissa >>= 1;
418
+ normalizedExponent++;
419
+ if (normalizedExponent > 127) {
420
+ return (sign << 31) | F32_INF;
421
+ }
422
+ }
423
+ return makeFloat_(sign, normalizedExponent, mantissa);
424
+ }
425
+
426
+ int subnormalShift = -149 - exponent;
427
+ mantissa = roundShiftRight(significand, subnormalShift);
428
+ if (mantissa >= 0x800000u) {
429
+ return (sign << 31) | (1u << 23);
430
+ }
431
+ return (sign << 31) | mantissa;
432
+ }
433
+
434
+ /**
435
+ * Parse 8-byte memory as a float64 number according to IEEE 754
436
+ * https://en.wikipedia.org/wiki/Double-precision_floating-point_format
437
+ * Returns 8-byte memory as 2 float32 numbers, consisting of
438
+ * high part: fround(d)
439
+ * low part: d - fround(d)
440
+ */
441
+ uvec2 parseAsDouble(uvec2 d) {
442
+ #if LE
443
+ d = d.yx; // to big endian
444
+ #endif
445
+
446
+ uint sign = (d[0] >> 31) & 1u; // first bit
447
+ uint exponentBits = (d[0] >> 20) & 0x7ffu;
448
+ int exponent = int(exponentBits) - 1023; // next 11 bits
449
+ uint fractionHigh = d[0] & 0xfffffu;
450
+ uint fractionLow = d[1];
451
+
452
+ if (exponentBits == 0x7ffu) {
453
+ if (fractionHigh == 0u && fractionLow == 0u) {
454
+ return uvec2((sign << 31) | F32_INF, F32_NAN);
455
+ }
456
+ return uvec2(F32_NAN);
457
+ }
458
+
459
+ if (exponentBits == 0u) {
460
+ // All float64 subnormals are too small to survive a float32 split.
461
+ return uvec2(sign << 31);
462
+ }
463
+
464
+ if (exponent > 127) {
465
+ return uvec2((sign << 31) | F32_INF, ((1u - sign) << 31) | F32_INF);
466
+ }
467
+
468
+ uint hi_part;
469
+ uint low_part;
470
+
471
+ // float64 significand has 52 bits
472
+ // float32 significand has 23 bits
473
+ // The significand of the high part is the significand of the double, trimmed
474
+ uint f_hi = 0x800000u | (fractionHigh << 3) | (fractionLow >> 29);
475
+ uint f_low = fractionLow & 0x1fffffffu;
476
+
477
+ if (exponent < -126) {
478
+ // For tiny normals, the top 24 significand bits still contribute to the float32
479
+ // high part, but they land in the float32 subnormal range.
480
+ hi_part = makeFloat(sign, exponent - 23, f_hi);
481
+
482
+ // The residual keeps the remaining 29 significand bits at the original double scale.
483
+ low_part = makeFloat(sign, exponent - 52, f_low);
484
+ return uvec2(hi_part, low_part);
485
+ }
486
+
487
+ bool roundUp = f_low > 0x10000000u || (f_low == 0x10000000u && (f_hi & 1u) == 1u);
488
+
489
+ uint f_rounded = f_hi + (roundUp ? 1u : 0u);
490
+ int exponent_hi = exponent;
491
+ if (f_rounded == 0x1000000u) {
492
+ f_rounded = 0x800000u;
493
+ exponent_hi++;
494
+ }
495
+
496
+ if (exponent_hi > 127) {
497
+ // Overflows float32 limit
498
+ hi_part = (sign << 31) | F32_INF;
499
+ low_part = ((1u - sign) << 31) | F32_INF;
500
+ return uvec2(hi_part, low_part);
501
+ }
502
+
503
+ hi_part = makeFloat_(sign, exponent_hi, f_rounded);
504
+
505
+ int remainder = int(f_low);
506
+ uint sign_low = sign;
507
+ if (roundUp) {
508
+ remainder -= 0x20000000;
509
+ }
510
+ if (remainder < 0) {
511
+ sign_low = 1u - sign;
512
+ remainder = -remainder;
513
+ }
514
+ low_part = makeFloat(sign_low, exponent - 52, uint(remainder));
515
+
516
+ return uvec2(hi_part, low_part);
517
+ }
518
+
519
+ void fround(in uint x[X_LEN], out float result[X_LEN]) {
520
+ int n = X_LEN / 2;
521
+ for (int i = 0; i < n; i++) {
522
+ uvec2 f = parseAsDouble(uvec2(x[i * 2], x[i * 2 + 1]));
523
+ result[i] = uintBitsToFloat(f.x);
524
+ result[i + n] = uintBitsToFloat(f.y);
525
+ }
526
+ }
527
+ `, F = ({ inputs: e, output: t, target: n }) => (y({
528
+ module: {
529
+ name: "fround",
530
+ vs: P
531
+ },
532
+ inputs: e,
533
+ output: t,
534
+ operationType: "uint32",
535
+ outputBuffer: n
536
+ }), { success: !0 });
537
+ //#endregion
538
+ //#region node_modules/@luma.gl/gpgpu/dist/operations/webgl/common/random-access-transform.js
539
+ function I(e, t, n) {
540
+ let r = h(n), i = l(t, 1), a = Array.from({ length: e.size }, (e, t) => ` v[${t}] = ${i}(texelFetch(source_values_texture, ivec2(${t}, rowIndex), 0).r);`).join("\n");
541
+ return {
542
+ name: "source_values_texture",
543
+ vs: `
544
+ uniform highp ${r} source_values_texture;
545
+ void read_source_values(int rowIndex, out TYPE v[${e.size}]) {
546
+ ${a}
547
+ }
548
+ `
549
+ };
550
+ }
551
+ function L(t, n, r) {
552
+ let i = r.createTexture({
553
+ width: Math.max(t.size, 1),
554
+ height: t.length,
555
+ format: p(n),
556
+ usage: e.SAMPLE | e.COPY_DST
557
+ });
558
+ if (t.length === 0) return i;
559
+ let a = r.createCommandEncoder();
560
+ return a.copyBufferToTexture({
561
+ sourceBuffer: t.buffer,
562
+ destinationTexture: i,
563
+ byteOffset: t.offset,
564
+ bytesPerRow: t.stride,
565
+ rowsPerImage: t.length,
566
+ size: [
567
+ t.size,
568
+ t.length,
569
+ 1
570
+ ]
571
+ }), r.submit(a.finish()), i;
572
+ }
573
+ //#endregion
574
+ //#region node_modules/@luma.gl/gpgpu/dist/operations/webgl/gather.js
575
+ var R = async ({ inputs: e, output: t, target: r }) => {
576
+ let { ids: i, sourceValues: a } = e, o = r.device, s = C("result", t.type, t.size), c = l(i.type, 1), u = l(t.type, 1), d = m(t.type), f = L(a, d, o), p = `\
577
+ #version 300 es
578
+
579
+ void main() {
580
+ INDEX_TYPE ids[1];
581
+ get_ids(ids);
582
+ TYPE result[${t.size}];
583
+ gather(ids, result);
584
+ set_result(result);
585
+ }
586
+ `, h = new n(o, {
587
+ vs: p,
588
+ defines: {
589
+ INDEX_TYPE: c,
590
+ TYPE: u,
591
+ RESULT_LEN: t.size.toString(),
592
+ SOURCE_VALUES_ROWS: a.length.toString()
593
+ },
594
+ modules: [
595
+ z(i, c),
596
+ I(a, t.type, d),
597
+ V(t.type),
598
+ s
599
+ ],
600
+ bindings: { source_values_texture: f },
601
+ bufferLayout: [B(i)],
602
+ vertexCount: 1,
603
+ instanceCount: t.length,
604
+ feedbackBufferMode: "interleaved",
605
+ outputs: s.varyings
606
+ });
607
+ try {
608
+ return h.run({
609
+ inputBuffers: { ids: i.buffer },
610
+ outputBuffers: { [s.varyings[0]]: r }
611
+ }), { success: !0 };
612
+ } finally {
613
+ h.destroy(), f.destroy();
614
+ }
615
+ };
616
+ function z(e, t) {
617
+ let n = l(e.type, 1), r = "aids_0";
618
+ return e.type !== H(t) && (r = `${t}(${r})`), {
619
+ name: "ids",
620
+ vs: `
621
+ in ${n} aids_0;
622
+ void get_ids(out INDEX_TYPE v[1]) {
623
+ v[0] = ${r};
624
+ }
625
+ `
626
+ };
627
+ }
628
+ function B(e) {
629
+ return {
630
+ name: "ids",
631
+ stepMode: e.isConstant ? "vertex" : "instance",
632
+ byteStride: e.stride,
633
+ attributes: [{
634
+ attribute: "aids_0",
635
+ format: u(e.type, 1, e.normalized),
636
+ byteOffset: e.offset
637
+ }]
638
+ };
639
+ }
640
+ function V(e) {
641
+ return {
642
+ name: "gather",
643
+ vs: `
644
+ void zero_result(out TYPE result[RESULT_LEN]) {
645
+ for (int i = 0; i < RESULT_LEN; i++) {
646
+ result[i] = ${d(e)};
647
+ }
648
+ }
649
+
650
+ void gather(in INDEX_TYPE ids[1], out TYPE result[RESULT_LEN]) {
651
+ int sourceIndex = int(ids[0]);
652
+ if (sourceIndex < 0 || sourceIndex >= SOURCE_VALUES_ROWS) {
653
+ zero_result(result);
654
+ return;
655
+ }
656
+ read_source_values(sourceIndex, result);
657
+ }
658
+ `
659
+ };
660
+ }
661
+ function H(e) {
662
+ switch (e) {
663
+ case "uint": return "uint32";
664
+ case "int": return "sint32";
665
+ default: return "float32";
666
+ }
667
+ }
668
+ //#endregion
669
+ //#region node_modules/@luma.gl/gpgpu/dist/operations/webgl/dot.js
670
+ var U = "void row_dot(in TYPE x[X_LEN], in TYPE y[Y_LEN], out float result[1]) {\n float sum = 0.0;\n for (int i = 0; i < X_LEN; i++) {\n sum += float(x[i]) * float(y[i]);\n }\n result[0] = sum;\n}\n", W = ({ inputs: e, output: t, target: n }) => (y({
671
+ module: {
672
+ name: "row_dot",
673
+ vs: U
674
+ },
675
+ inputs: e,
676
+ output: t,
677
+ operationType: "float32",
678
+ outputBuffer: n
679
+ }), { success: !0 }), G = "void equalAll(in TYPE x[X_LEN], in TYPE y[Y_LEN], out uint result[1]) {\n uint allEqual = uint(1);\n for (int i = 0; i < X_LEN; i++) {\n if (x[i] != y[i]) {\n allEqual = uint(0);\n break;\n }\n }\n result[0] = allEqual;\n}\n", K = ({ inputs: e, output: t, target: n }) => (y({
680
+ module: {
681
+ name: "equalAll",
682
+ vs: G
683
+ },
684
+ inputs: e,
685
+ output: t,
686
+ operationType: t.type === "uint32" ? e.x.type : t.type,
687
+ outputBuffer: n
688
+ }), { success: !0 }), q = "void row_length(in TYPE x[X_LEN], out float result[1]) {\n float sum = 0.0;\n for (int i = 0; i < X_LEN; i++) {\n sum += float(x[i]) * float(x[i]);\n }\n result[0] = sqrt(sum);\n}\n", J = ({ inputs: e, output: t, target: n }) => (y({
689
+ module: {
690
+ name: "row_length",
691
+ vs: q
692
+ },
693
+ inputs: e,
694
+ output: t,
695
+ operationType: "float32",
696
+ outputBuffer: n
697
+ }), { success: !0 }), Y = async ({ inputs: e, output: t, target: r }) => {
698
+ let { segments: i } = e, a = r.device, o = C("result", t.type, t.size), s = m(i.type), c = L(i, s, a), l = new n(a, {
699
+ vs: "#version 300 es\n\nvoid main() {\n TYPE result[RESULT_LEN];\n segmentedMap(result);\n set_result(result);\n}\n",
700
+ defines: {
701
+ TYPE: "uint",
702
+ RESULT_LEN: t.size.toString(),
703
+ SEGMENTS_LENGTH: i.length.toString()
704
+ },
705
+ modules: [
706
+ I(i, t.type, s),
707
+ X(),
708
+ o
709
+ ],
710
+ bindings: { source_values_texture: c },
711
+ vertexCount: 1,
712
+ instanceCount: t.length,
713
+ feedbackBufferMode: "interleaved",
714
+ outputs: o.varyings
715
+ });
716
+ try {
717
+ return l.run({ outputBuffers: { [o.varyings[0]]: r } }), { success: !0 };
718
+ } finally {
719
+ l.destroy(), c.destroy();
720
+ }
721
+ };
722
+ function X() {
723
+ return {
724
+ name: "segmentedMap",
725
+ vs: "\nuint read_segment_start(int segmentIndex) {\n TYPE value[1];\n read_source_values(segmentIndex, value);\n return uint(value[0]);\n}\n\nvoid segmentedMap(out TYPE result[RESULT_LEN]) {\n uint vertexIndex = uint(gl_InstanceID);\n int low = 0;\n int high = SEGMENTS_LENGTH;\n\n while (low < high) {\n int mid = low + (high - low) / 2;\n uint midStart = read_segment_start(mid);\n if (midStart <= vertexIndex) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n\n uint segmentIndex = uint(max(low - 1, 0));\n uint segmentStart = read_segment_start(int(segmentIndex));\n result[0] = segmentIndex;\n result[1] = vertexIndex - segmentStart;\n}\n"
726
+ };
727
+ }
728
+ //#endregion
729
+ //#region node_modules/@luma.gl/gpgpu/dist/operations/webgl/select.js
730
+ var Z = async ({ inputs: e, output: t, target: n }) => {
731
+ let r = d(l(t.type, 1, t.normalized));
732
+ return y({
733
+ module: {
734
+ name: "select",
735
+ vs: ""
736
+ },
737
+ inputs: e,
738
+ output: t,
739
+ operationType: t.type,
740
+ outputBuffer: n,
741
+ expression: (t) => {
742
+ let n = Q("condition", e.condition, t, r), i = Q("whenTrue", e.whenTrue, t, r), a = Q("whenFalse", e.whenFalse, t, r);
743
+ return `(${n} != ${r} ? ${i} : ${a})`;
744
+ }
745
+ }), { success: !0 };
746
+ };
747
+ function Q(e, t, n, r) {
748
+ return n < t.size ? `${e}[${n}]` : t.size === 1 ? `${e}[0]` : r;
749
+ }
750
+ //#endregion
751
+ //#region node_modules/@luma.gl/gpgpu/dist/operations/webgl/sequence.js
752
+ var $ = ({ inputs: e, output: t, target: r }) => {
753
+ let i = C("result", t.type, t.size), a = new n(r.device, {
754
+ vs: "#version 300 es\n\nvoid main() {\n int result[1];\n result[0] = START + gl_InstanceID * STEP;\n set_result(result);\n}\n",
755
+ defines: {
756
+ START: e.start.toString(),
757
+ STEP: e.step.toString()
758
+ },
759
+ modules: [i],
760
+ vertexCount: 1,
761
+ instanceCount: t.length,
762
+ feedbackBufferMode: "interleaved",
763
+ outputs: i.varyings
764
+ });
765
+ try {
766
+ return a.run({ outputBuffers: { [i.varyings[0]]: r } }), { success: !0 };
767
+ } finally {
768
+ a.destroy();
769
+ }
770
+ }, ee = ({ inputs: e, output: t, target: n }) => {
771
+ let { columns: r } = e;
772
+ return y({
773
+ module: {
774
+ name: "swizzle",
775
+ vs: "// swizzle expression handled inline"
776
+ },
777
+ expression: (e) => `x[${r[e]}]`,
778
+ inputs: { x: e.x },
779
+ output: t,
780
+ outputBuffer: n
781
+ }), { success: !0 };
782
+ };
783
+ //#endregion
784
+ export { T as arithmetic, W as dot, K as equalAll, O as extent, F as fround, R as gather, A as interleave, J as length, Y as segmentedMap, Z as select, $ as sequence, ee as swizzle };