holostaff-widget 2.0.0

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,1723 @@
1
+ import { o as L, p as A, e as l, q as D, b as ce, t as de, D as B, S as C, a as T, B as he, v as k, x as w, w as v, y, j as pe, z as le, H as z, I as M, M as F, J as O, K as fe, L as I, N as ge, O as W, T as R, A as me, R as _e, k as S } from "./index-DjIeNhPr.js";
2
+ import { c as be, u as ye, U as xe, B as Ge, G as Pe, e as Be, l as Se, a as Te, t as Ce } from "./BufferResource-Bh7Dg2tm.js";
3
+ import { R as ve, S as Ue, d as we } from "./RenderTargetSystem-B-GzTxxb.js";
4
+ const G = A.for2d();
5
+ class H {
6
+ start(e, t, r) {
7
+ const s = e.renderer, i = s.encoder, n = r.gpuProgram;
8
+ this._shader = r, this._geometry = t, i.setGeometry(t, n), G.blendMode = "normal", s.pipeline.getPipeline(
9
+ t,
10
+ n,
11
+ G
12
+ );
13
+ const o = s.globalUniforms.bindGroup;
14
+ i.resetBindGroup(1), i.setBindGroup(0, o, n);
15
+ }
16
+ execute(e, t) {
17
+ const r = this._shader.gpuProgram, s = e.renderer, i = s.encoder;
18
+ if (!t.bindGroup) {
19
+ const u = t.textures;
20
+ t.bindGroup = L(
21
+ u.textures,
22
+ u.count,
23
+ s.limits.maxBatchableTextures
24
+ );
25
+ }
26
+ G.blendMode = t.blendMode;
27
+ const n = s.bindGroup.getBindGroup(
28
+ t.bindGroup,
29
+ r,
30
+ 1
31
+ ), o = s.pipeline.getPipeline(
32
+ this._geometry,
33
+ r,
34
+ G,
35
+ t.topology
36
+ );
37
+ t.bindGroup._touch(s.gc.now, s.tick), i.setPipeline(o), i.renderPassEncoder.setBindGroup(1, n), i.renderPassEncoder.drawIndexed(t.size, 1, t.start);
38
+ }
39
+ }
40
+ H.extension = {
41
+ type: [
42
+ l.WebGPUPipesAdaptor
43
+ ],
44
+ name: "batch"
45
+ };
46
+ class V {
47
+ constructor(e) {
48
+ this._hash = /* @__PURE__ */ Object.create(null), this._renderer = e;
49
+ }
50
+ contextChange(e) {
51
+ this._gpu = e;
52
+ }
53
+ getBindGroup(e, t, r) {
54
+ return e._updateKey(), this._hash[e._key] || this._createBindGroup(e, t, r);
55
+ }
56
+ _createBindGroup(e, t, r) {
57
+ const s = this._gpu.device, i = t.layout[r], n = [], o = this._renderer;
58
+ for (const f in i) {
59
+ const h = e.resources[f] ?? e.resources[i[f]];
60
+ let p;
61
+ if (h._resourceType === "uniformGroup") {
62
+ const d = h;
63
+ o.ubo.updateUniformGroup(d);
64
+ const g = d.buffer;
65
+ p = {
66
+ buffer: o.buffer.getGPUBuffer(g),
67
+ offset: 0,
68
+ size: g.descriptor.size
69
+ };
70
+ } else if (h._resourceType === "buffer") {
71
+ const d = h;
72
+ p = {
73
+ buffer: o.buffer.getGPUBuffer(d),
74
+ offset: 0,
75
+ size: d.descriptor.size
76
+ };
77
+ } else if (h._resourceType === "bufferResource") {
78
+ const d = h;
79
+ p = {
80
+ buffer: o.buffer.getGPUBuffer(d.buffer),
81
+ offset: d.offset,
82
+ size: d.size
83
+ };
84
+ } else if (h._resourceType === "textureSampler") {
85
+ const d = h;
86
+ p = o.texture.getGpuSampler(d);
87
+ } else if (h._resourceType === "textureSource") {
88
+ const d = h;
89
+ p = o.texture.getTextureView(d);
90
+ }
91
+ n.push({
92
+ binding: i[f],
93
+ resource: p
94
+ });
95
+ }
96
+ const u = o.shader.getProgramData(t).bindGroups[r], c = s.createBindGroup({
97
+ layout: u,
98
+ entries: n
99
+ });
100
+ return this._hash[e._key] = c, c;
101
+ }
102
+ destroy() {
103
+ this._hash = null, this._renderer = null;
104
+ }
105
+ }
106
+ V.extension = {
107
+ type: [
108
+ l.WebGPUSystem
109
+ ],
110
+ name: "bindGroup"
111
+ };
112
+ class Me {
113
+ constructor(e) {
114
+ this.gpuBuffer = e;
115
+ }
116
+ destroy() {
117
+ this.gpuBuffer.destroy(), this.gpuBuffer = null;
118
+ }
119
+ }
120
+ class N {
121
+ constructor(e) {
122
+ this._renderer = e, this._managedBuffers = new D({
123
+ renderer: e,
124
+ type: "resource",
125
+ onUnload: this.onBufferUnload.bind(this),
126
+ name: "gpuBuffer"
127
+ });
128
+ }
129
+ contextChange(e) {
130
+ this._gpu = e;
131
+ }
132
+ getGPUBuffer(e) {
133
+ var t;
134
+ return e._gcLastUsed = this._renderer.gc.now, ((t = e._gpuData[this._renderer.uid]) == null ? void 0 : t.gpuBuffer) || this.createGPUBuffer(e);
135
+ }
136
+ updateBuffer(e) {
137
+ const t = this.getGPUBuffer(e), r = e.data;
138
+ return e._updateID && r && (e._updateID = 0, this._gpu.device.queue.writeBuffer(
139
+ t,
140
+ 0,
141
+ r.buffer,
142
+ 0,
143
+ // round to the nearest 4 bytes
144
+ (e._updateSize || r.byteLength) + 3 & -4
145
+ )), t;
146
+ }
147
+ /** dispose all WebGL resources of all managed buffers */
148
+ destroyAll() {
149
+ this._managedBuffers.removeAll();
150
+ }
151
+ onBufferUnload(e) {
152
+ e.off("update", this.updateBuffer, this), e.off("change", this.onBufferChange, this);
153
+ }
154
+ createGPUBuffer(e) {
155
+ const t = this._gpu.device.createBuffer(e.descriptor);
156
+ return e._updateID = 0, e._resourceId = ce("resource"), e.data && (de(
157
+ e.data.buffer,
158
+ t.getMappedRange(),
159
+ e.data.byteOffset,
160
+ e.data.byteLength
161
+ ), t.unmap()), e._gpuData[this._renderer.uid] = new Me(t), this._managedBuffers.add(e) && (e.on("update", this.updateBuffer, this), e.on("change", this.onBufferChange, this)), t;
162
+ }
163
+ onBufferChange(e) {
164
+ this._managedBuffers.remove(e), e._updateID = 0, this.createGPUBuffer(e);
165
+ }
166
+ destroy() {
167
+ this._managedBuffers.destroy(), this._renderer = null, this._gpu = null;
168
+ }
169
+ }
170
+ N.extension = {
171
+ type: [
172
+ l.WebGPUSystem
173
+ ],
174
+ name: "buffer"
175
+ };
176
+ class Re {
177
+ constructor({ minUniformOffsetAlignment: e }) {
178
+ this._minUniformOffsetAlignment = 256, this.byteIndex = 0, this._minUniformOffsetAlignment = e, this.data = new Float32Array(65535);
179
+ }
180
+ clear() {
181
+ this.byteIndex = 0;
182
+ }
183
+ addEmptyGroup(e) {
184
+ if (e > this._minUniformOffsetAlignment / 4)
185
+ throw new Error(`UniformBufferBatch: array is too large: ${e * 4}`);
186
+ const t = this.byteIndex;
187
+ let r = t + e * 4;
188
+ if (r = Math.ceil(r / this._minUniformOffsetAlignment) * this._minUniformOffsetAlignment, r > this.data.length * 4)
189
+ throw new Error("UniformBufferBatch: ubo batch got too big");
190
+ return this.byteIndex = r, t;
191
+ }
192
+ addGroup(e) {
193
+ const t = this.addEmptyGroup(e.length);
194
+ for (let r = 0; r < e.length; r++)
195
+ this.data[t / 4 + r] = e[r];
196
+ return t;
197
+ }
198
+ destroy() {
199
+ this.data = null;
200
+ }
201
+ }
202
+ class j {
203
+ constructor(e) {
204
+ this._colorMaskCache = 15, this._renderer = e;
205
+ }
206
+ setMask(e) {
207
+ this._colorMaskCache !== e && (this._colorMaskCache = e, this._renderer.pipeline.setColorMask(e));
208
+ }
209
+ destroy() {
210
+ this._renderer = null, this._colorMaskCache = null;
211
+ }
212
+ }
213
+ j.extension = {
214
+ type: [
215
+ l.WebGPUSystem
216
+ ],
217
+ name: "colorMask"
218
+ };
219
+ class U {
220
+ /**
221
+ * @param {WebGPURenderer} renderer - The renderer this System works for.
222
+ */
223
+ constructor(e) {
224
+ this._renderer = e;
225
+ }
226
+ async init(e) {
227
+ return this._initPromise ? this._initPromise : (this._initPromise = (e.gpu ? Promise.resolve(e.gpu) : this._createDeviceAndAdaptor(e)).then((t) => {
228
+ this.gpu = t, this._renderer.runners.contextChange.emit(this.gpu);
229
+ }), this._initPromise);
230
+ }
231
+ /**
232
+ * Handle the context change event
233
+ * @param gpu
234
+ */
235
+ contextChange(e) {
236
+ this._renderer.gpu = e;
237
+ }
238
+ /**
239
+ * Helper class to create a WebGL Context
240
+ * @param {object} options - An options object that gets passed in to the canvas element containing the
241
+ * context attributes
242
+ * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext
243
+ * @returns {WebGLRenderingContext} the WebGL context
244
+ */
245
+ async _createDeviceAndAdaptor(e) {
246
+ const t = await B.get().getNavigator().gpu.requestAdapter({
247
+ powerPreference: e.powerPreference,
248
+ forceFallbackAdapter: e.forceFallbackAdapter
249
+ }), r = [
250
+ "texture-compression-bc",
251
+ "texture-compression-astc",
252
+ "texture-compression-etc2"
253
+ ].filter((i) => t.features.has(i)), s = await t.requestDevice({
254
+ requiredFeatures: r
255
+ });
256
+ return { adapter: t, device: s };
257
+ }
258
+ destroy() {
259
+ this.gpu = null, this._renderer = null;
260
+ }
261
+ }
262
+ U.extension = {
263
+ type: [
264
+ l.WebGPUSystem
265
+ ],
266
+ name: "device"
267
+ };
268
+ U.defaultOptions = {
269
+ /**
270
+ * {@link WebGPUOptions.powerPreference}
271
+ * @default default
272
+ */
273
+ powerPreference: void 0,
274
+ /**
275
+ * Force the use of the fallback adapter
276
+ * @default false
277
+ */
278
+ forceFallbackAdapter: !1
279
+ };
280
+ class K {
281
+ constructor(e) {
282
+ this._boundBindGroup = /* @__PURE__ */ Object.create(null), this._boundVertexBuffer = /* @__PURE__ */ Object.create(null), this._renderer = e;
283
+ }
284
+ renderStart() {
285
+ this.commandFinished = new Promise((e) => {
286
+ this._resolveCommandFinished = e;
287
+ }), this.commandEncoder = this._renderer.gpu.device.createCommandEncoder();
288
+ }
289
+ beginRenderPass(e) {
290
+ this.endRenderPass(), this._clearCache(), this.renderPassEncoder = this.commandEncoder.beginRenderPass(e.descriptor);
291
+ }
292
+ endRenderPass() {
293
+ this.renderPassEncoder && this.renderPassEncoder.end(), this.renderPassEncoder = null;
294
+ }
295
+ setViewport(e) {
296
+ this.renderPassEncoder.setViewport(e.x, e.y, e.width, e.height, 0, 1);
297
+ }
298
+ setPipelineFromGeometryProgramAndState(e, t, r, s) {
299
+ const i = this._renderer.pipeline.getPipeline(e, t, r, s);
300
+ this.setPipeline(i);
301
+ }
302
+ setPipeline(e) {
303
+ this._boundPipeline !== e && (this._boundPipeline = e, this.renderPassEncoder.setPipeline(e));
304
+ }
305
+ _setVertexBuffer(e, t) {
306
+ this._boundVertexBuffer[e] !== t && (this._boundVertexBuffer[e] = t, this.renderPassEncoder.setVertexBuffer(e, this._renderer.buffer.updateBuffer(t)));
307
+ }
308
+ _setIndexBuffer(e) {
309
+ if (this._boundIndexBuffer === e) return;
310
+ this._boundIndexBuffer = e;
311
+ const t = e.data.BYTES_PER_ELEMENT === 2 ? "uint16" : "uint32";
312
+ this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e), t);
313
+ }
314
+ resetBindGroup(e) {
315
+ this._boundBindGroup[e] = null;
316
+ }
317
+ setBindGroup(e, t, r) {
318
+ if (this._boundBindGroup[e] === t) return;
319
+ this._boundBindGroup[e] = t, t._touch(this._renderer.gc.now, this._renderer.tick);
320
+ const s = this._renderer.bindGroup.getBindGroup(t, r, e);
321
+ this.renderPassEncoder.setBindGroup(e, s);
322
+ }
323
+ setGeometry(e, t) {
324
+ const r = this._renderer.pipeline.getBufferNamesToBind(e, t);
325
+ for (const s in r)
326
+ this._setVertexBuffer(parseInt(s, 10), e.attributes[r[s]].buffer);
327
+ e.indexBuffer && this._setIndexBuffer(e.indexBuffer);
328
+ }
329
+ _setShaderBindGroups(e, t) {
330
+ for (const r in e.groups) {
331
+ const s = e.groups[r];
332
+ t || this._syncBindGroup(s), this.setBindGroup(r, s, e.gpuProgram);
333
+ }
334
+ }
335
+ _syncBindGroup(e) {
336
+ for (const t in e.resources) {
337
+ const r = e.resources[t];
338
+ r.isUniformGroup && this._renderer.ubo.updateUniformGroup(r);
339
+ }
340
+ }
341
+ draw(e) {
342
+ const { geometry: t, shader: r, state: s, topology: i, size: n, start: o, instanceCount: u, skipSync: c } = e;
343
+ this.setPipelineFromGeometryProgramAndState(t, r.gpuProgram, s, i), this.setGeometry(t, r.gpuProgram), this._setShaderBindGroups(r, c), t.indexBuffer ? this.renderPassEncoder.drawIndexed(
344
+ n || t.indexBuffer.data.length,
345
+ u ?? t.instanceCount,
346
+ o || 0
347
+ ) : this.renderPassEncoder.draw(n || t.getSize(), u ?? t.instanceCount, o || 0);
348
+ }
349
+ finishRenderPass() {
350
+ this.renderPassEncoder && (this.renderPassEncoder.end(), this.renderPassEncoder = null);
351
+ }
352
+ postrender() {
353
+ this.finishRenderPass(), this._gpu.device.queue.submit([this.commandEncoder.finish()]), this._resolveCommandFinished(), this.commandEncoder = null;
354
+ }
355
+ // restores a render pass if finishRenderPass was called
356
+ // not optimised as really used for debugging!
357
+ // used when we want to stop drawing and log a texture..
358
+ restoreRenderPass() {
359
+ const e = this._renderer.renderTarget.adaptor.getDescriptor(
360
+ this._renderer.renderTarget.renderTarget,
361
+ !1,
362
+ [0, 0, 0, 1],
363
+ this._renderer.renderTarget.mipLevel,
364
+ this._renderer.renderTarget.layer
365
+ );
366
+ this.renderPassEncoder = this.commandEncoder.beginRenderPass(e);
367
+ const t = this._boundPipeline, r = { ...this._boundVertexBuffer }, s = this._boundIndexBuffer, i = { ...this._boundBindGroup };
368
+ this._clearCache();
369
+ const n = this._renderer.renderTarget.viewport;
370
+ this.renderPassEncoder.setViewport(n.x, n.y, n.width, n.height, 0, 1), this.setPipeline(t);
371
+ for (const o in r)
372
+ this._setVertexBuffer(o, r[o]);
373
+ for (const o in i)
374
+ this.setBindGroup(o, i[o], null);
375
+ this._setIndexBuffer(s);
376
+ }
377
+ _clearCache() {
378
+ for (let e = 0; e < 16; e++)
379
+ this._boundBindGroup[e] = null, this._boundVertexBuffer[e] = null;
380
+ this._boundIndexBuffer = null, this._boundPipeline = null;
381
+ }
382
+ destroy() {
383
+ this._renderer = null, this._gpu = null, this._boundBindGroup = null, this._boundVertexBuffer = null, this._boundIndexBuffer = null, this._boundPipeline = null;
384
+ }
385
+ contextChange(e) {
386
+ this._gpu = e;
387
+ }
388
+ }
389
+ K.extension = {
390
+ type: [l.WebGPUSystem],
391
+ name: "encoder",
392
+ priority: 1
393
+ };
394
+ class q {
395
+ constructor(e) {
396
+ this._renderer = e;
397
+ }
398
+ contextChange() {
399
+ this.maxTextures = this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage, this.maxBatchableTextures = this.maxTextures;
400
+ }
401
+ destroy() {
402
+ }
403
+ }
404
+ q.extension = {
405
+ type: [
406
+ l.WebGPUSystem
407
+ ],
408
+ name: "limits"
409
+ };
410
+ class Y {
411
+ constructor(e) {
412
+ this._renderTargetStencilState = /* @__PURE__ */ Object.create(null), this._renderer = e, e.renderTarget.onRenderTargetChange.add(this);
413
+ }
414
+ onRenderTargetChange(e) {
415
+ let t = this._renderTargetStencilState[e.uid];
416
+ t || (t = this._renderTargetStencilState[e.uid] = {
417
+ stencilMode: C.DISABLED,
418
+ stencilReference: 0
419
+ }), this._activeRenderTarget = e, this.setStencilMode(t.stencilMode, t.stencilReference);
420
+ }
421
+ setStencilMode(e, t) {
422
+ const r = this._renderTargetStencilState[this._activeRenderTarget.uid];
423
+ r.stencilMode = e, r.stencilReference = t;
424
+ const s = this._renderer;
425
+ s.pipeline.setStencilMode(e), s.encoder.renderPassEncoder.setStencilReference(t);
426
+ }
427
+ destroy() {
428
+ this._renderer.renderTarget.onRenderTargetChange.remove(this), this._renderer = null, this._activeRenderTarget = null, this._renderTargetStencilState = null;
429
+ }
430
+ }
431
+ Y.extension = {
432
+ type: [
433
+ l.WebGPUSystem
434
+ ],
435
+ name: "stencil"
436
+ };
437
+ const P = {
438
+ i32: { align: 4, size: 4 },
439
+ u32: { align: 4, size: 4 },
440
+ f32: { align: 4, size: 4 },
441
+ f16: { align: 2, size: 2 },
442
+ "vec2<i32>": { align: 8, size: 8 },
443
+ "vec2<u32>": { align: 8, size: 8 },
444
+ "vec2<f32>": { align: 8, size: 8 },
445
+ "vec2<f16>": { align: 4, size: 4 },
446
+ "vec3<i32>": { align: 16, size: 12 },
447
+ "vec3<u32>": { align: 16, size: 12 },
448
+ "vec3<f32>": { align: 16, size: 12 },
449
+ "vec3<f16>": { align: 8, size: 6 },
450
+ "vec4<i32>": { align: 16, size: 16 },
451
+ "vec4<u32>": { align: 16, size: 16 },
452
+ "vec4<f32>": { align: 16, size: 16 },
453
+ "vec4<f16>": { align: 8, size: 8 },
454
+ "mat2x2<f32>": { align: 8, size: 16 },
455
+ "mat2x2<f16>": { align: 4, size: 8 },
456
+ "mat3x2<f32>": { align: 8, size: 24 },
457
+ "mat3x2<f16>": { align: 4, size: 12 },
458
+ "mat4x2<f32>": { align: 8, size: 32 },
459
+ "mat4x2<f16>": { align: 4, size: 16 },
460
+ "mat2x3<f32>": { align: 16, size: 32 },
461
+ "mat2x3<f16>": { align: 8, size: 16 },
462
+ "mat3x3<f32>": { align: 16, size: 48 },
463
+ "mat3x3<f16>": { align: 8, size: 24 },
464
+ "mat4x3<f32>": { align: 16, size: 64 },
465
+ "mat4x3<f16>": { align: 8, size: 32 },
466
+ "mat2x4<f32>": { align: 16, size: 32 },
467
+ "mat2x4<f16>": { align: 8, size: 16 },
468
+ "mat3x4<f32>": { align: 16, size: 48 },
469
+ "mat3x4<f16>": { align: 8, size: 24 },
470
+ "mat4x4<f32>": { align: 16, size: 64 },
471
+ "mat4x4<f16>": { align: 8, size: 32 }
472
+ };
473
+ function Ee(a) {
474
+ const e = a.map((r) => ({
475
+ data: r,
476
+ offset: 0,
477
+ size: 0
478
+ }));
479
+ let t = 0;
480
+ for (let r = 0; r < e.length; r++) {
481
+ const s = e[r];
482
+ let i = P[s.data.type].size;
483
+ const n = P[s.data.type].align;
484
+ if (!P[s.data.type])
485
+ throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);
486
+ s.data.size > 1 && (i = Math.max(i, n) * s.data.size), t = Math.ceil(t / n) * n, s.size = i, s.offset = t, t += i;
487
+ }
488
+ return t = Math.ceil(t / 16) * 16, { uboElements: e, size: t };
489
+ }
490
+ function Le(a, e) {
491
+ const { size: t, align: r } = P[a.data.type], s = (r - t) / 4, i = a.data.type.indexOf("i32") >= 0 ? "dataInt32" : "data";
492
+ return `
493
+ v = uv.${a.data.name};
494
+ ${e !== 0 ? `offset += ${e};` : ""}
495
+
496
+ arrayOffset = offset;
497
+
498
+ t = 0;
499
+
500
+ for(var i=0; i < ${a.data.size * (t / 4)}; i++)
501
+ {
502
+ for(var j = 0; j < ${t / 4}; j++)
503
+ {
504
+ ${i}[arrayOffset++] = v[t++];
505
+ }
506
+ ${s !== 0 ? `arrayOffset += ${s};` : ""}
507
+ }
508
+ `;
509
+ }
510
+ function Ae(a) {
511
+ return be(
512
+ a,
513
+ "uboWgsl",
514
+ Le,
515
+ ye
516
+ );
517
+ }
518
+ class $ extends xe {
519
+ constructor() {
520
+ super({
521
+ createUboElements: Ee,
522
+ generateUboSync: Ae
523
+ });
524
+ }
525
+ }
526
+ $.extension = {
527
+ type: [l.WebGPUSystem],
528
+ name: "ubo"
529
+ };
530
+ const b = 128;
531
+ class X {
532
+ constructor(e) {
533
+ this._bindGroupHash = /* @__PURE__ */ Object.create(null), this._buffers = [], this._bindGroups = [], this._bufferResources = [], this._renderer = e, this._batchBuffer = new Re({ minUniformOffsetAlignment: b });
534
+ const t = 256 / b;
535
+ for (let r = 0; r < t; r++) {
536
+ let s = T.UNIFORM | T.COPY_DST;
537
+ r === 0 && (s |= T.COPY_SRC), this._buffers.push(new he({
538
+ data: this._batchBuffer.data,
539
+ usage: s
540
+ }));
541
+ }
542
+ }
543
+ renderEnd() {
544
+ this._uploadBindGroups(), this._resetBindGroups();
545
+ }
546
+ _resetBindGroups() {
547
+ this._bindGroupHash = /* @__PURE__ */ Object.create(null), this._batchBuffer.clear();
548
+ }
549
+ // just works for single bind groups for now
550
+ getUniformBindGroup(e, t) {
551
+ if (!t && this._bindGroupHash[e.uid])
552
+ return this._bindGroupHash[e.uid];
553
+ this._renderer.ubo.ensureUniformGroup(e);
554
+ const r = e.buffer.data, s = this._batchBuffer.addEmptyGroup(r.length);
555
+ return this._renderer.ubo.syncUniformGroup(e, this._batchBuffer.data, s / 4), this._bindGroupHash[e.uid] = this._getBindGroup(s / b), this._bindGroupHash[e.uid];
556
+ }
557
+ getUboResource(e) {
558
+ this._renderer.ubo.updateUniformGroup(e);
559
+ const t = e.buffer.data, r = this._batchBuffer.addGroup(t);
560
+ return this._getBufferResource(r / b);
561
+ }
562
+ getArrayBindGroup(e) {
563
+ const t = this._batchBuffer.addGroup(e);
564
+ return this._getBindGroup(t / b);
565
+ }
566
+ getArrayBufferResource(e) {
567
+ const r = this._batchBuffer.addGroup(e) / b;
568
+ return this._getBufferResource(r);
569
+ }
570
+ _getBufferResource(e) {
571
+ if (!this._bufferResources[e]) {
572
+ const t = this._buffers[e % 2];
573
+ this._bufferResources[e] = new Ge({
574
+ buffer: t,
575
+ offset: (e / 2 | 0) * 256,
576
+ size: b
577
+ });
578
+ }
579
+ return this._bufferResources[e];
580
+ }
581
+ _getBindGroup(e) {
582
+ if (!this._bindGroups[e]) {
583
+ const t = new k({
584
+ 0: this._getBufferResource(e)
585
+ });
586
+ this._bindGroups[e] = t;
587
+ }
588
+ return this._bindGroups[e];
589
+ }
590
+ _uploadBindGroups() {
591
+ const e = this._renderer.buffer, t = this._buffers[0];
592
+ t.update(this._batchBuffer.byteIndex), e.updateBuffer(t);
593
+ const r = this._renderer.gpu.device.createCommandEncoder();
594
+ for (let s = 1; s < this._buffers.length; s++) {
595
+ const i = this._buffers[s];
596
+ r.copyBufferToBuffer(
597
+ e.getGPUBuffer(t),
598
+ b,
599
+ e.getGPUBuffer(i),
600
+ 0,
601
+ this._batchBuffer.byteIndex
602
+ );
603
+ }
604
+ this._renderer.gpu.device.queue.submit([r.finish()]);
605
+ }
606
+ destroy() {
607
+ var e;
608
+ for (let t = 0; t < this._bindGroups.length; t++)
609
+ (e = this._bindGroups[t]) == null || e.destroy();
610
+ this._bindGroups = null, this._bindGroupHash = null;
611
+ for (let t = 0; t < this._buffers.length; t++)
612
+ this._buffers[t].destroy();
613
+ this._buffers = null;
614
+ for (let t = 0; t < this._bufferResources.length; t++)
615
+ this._bufferResources[t].destroy();
616
+ this._bufferResources = null, this._batchBuffer.destroy(), this._renderer = null;
617
+ }
618
+ }
619
+ X.extension = {
620
+ type: [
621
+ l.WebGPUPipes
622
+ ],
623
+ name: "uniformBatch"
624
+ };
625
+ const De = {
626
+ "point-list": 0,
627
+ "line-list": 1,
628
+ "line-strip": 2,
629
+ "triangle-list": 3,
630
+ "triangle-strip": 4
631
+ };
632
+ function ke(a, e, t, r, s) {
633
+ return a << 24 | e << 16 | t << 10 | r << 5 | s;
634
+ }
635
+ function ze(a, e, t, r, s) {
636
+ return t << 8 | a << 5 | r << 3 | s << 1 | e;
637
+ }
638
+ class J {
639
+ constructor(e) {
640
+ this._moduleCache = /* @__PURE__ */ Object.create(null), this._bufferLayoutsCache = /* @__PURE__ */ Object.create(null), this._bindingNamesCache = /* @__PURE__ */ Object.create(null), this._pipeCache = /* @__PURE__ */ Object.create(null), this._pipeStateCaches = /* @__PURE__ */ Object.create(null), this._colorMask = 15, this._multisampleCount = 1, this._colorTargetCount = 1, this._renderer = e;
641
+ }
642
+ contextChange(e) {
643
+ this._gpu = e, this.setStencilMode(C.DISABLED), this._updatePipeHash();
644
+ }
645
+ setMultisampleCount(e) {
646
+ this._multisampleCount !== e && (this._multisampleCount = e, this._updatePipeHash());
647
+ }
648
+ setRenderTarget(e) {
649
+ this._multisampleCount = e.msaaSamples, this._depthStencilAttachment = e.descriptor.depthStencilAttachment ? 1 : 0, this._colorTargetCount = e.colorTargetCount, this._updatePipeHash();
650
+ }
651
+ setColorMask(e) {
652
+ this._colorMask !== e && (this._colorMask = e, this._updatePipeHash());
653
+ }
654
+ setStencilMode(e) {
655
+ this._stencilMode !== e && (this._stencilMode = e, this._stencilState = Pe[e], this._updatePipeHash());
656
+ }
657
+ setPipeline(e, t, r, s) {
658
+ const i = this.getPipeline(e, t, r);
659
+ s.setPipeline(i);
660
+ }
661
+ getPipeline(e, t, r, s) {
662
+ e._layoutKey || (Be(e, t.attributeData), this._generateBufferKey(e)), s || (s = e.topology);
663
+ const i = ke(
664
+ e._layoutKey,
665
+ t._layoutKey,
666
+ r.data,
667
+ r._blendModeId,
668
+ De[s]
669
+ );
670
+ return this._pipeCache[i] ? this._pipeCache[i] : (this._pipeCache[i] = this._createPipeline(e, t, r, s), this._pipeCache[i]);
671
+ }
672
+ _createPipeline(e, t, r, s) {
673
+ const i = this._gpu.device, n = this._createVertexBufferLayouts(e, t), o = this._renderer.state.getColorTargets(r, this._colorTargetCount), u = this._stencilMode === C.RENDERING_MASK_ADD ? 0 : this._colorMask;
674
+ for (let p = 0; p < o.length; p++)
675
+ o[p].writeMask = u;
676
+ const c = this._renderer.shader.getProgramData(t).pipeline, f = {
677
+ // TODO later check if its helpful to create..
678
+ // layout,
679
+ vertex: {
680
+ module: this._getModule(t.vertex.source),
681
+ entryPoint: t.vertex.entryPoint,
682
+ // geometry..
683
+ buffers: n
684
+ },
685
+ fragment: {
686
+ module: this._getModule(t.fragment.source),
687
+ entryPoint: t.fragment.entryPoint,
688
+ targets: o
689
+ },
690
+ primitive: {
691
+ topology: s,
692
+ cullMode: r.cullMode
693
+ },
694
+ layout: c,
695
+ multisample: {
696
+ count: this._multisampleCount
697
+ },
698
+ // depthStencil,
699
+ label: "PIXI Pipeline"
700
+ };
701
+ return this._depthStencilAttachment && (f.depthStencil = {
702
+ ...this._stencilState,
703
+ format: "depth24plus-stencil8",
704
+ depthWriteEnabled: r.depthTest,
705
+ depthCompare: r.depthTest ? "less" : "always"
706
+ }), i.createRenderPipeline(f);
707
+ }
708
+ _getModule(e) {
709
+ return this._moduleCache[e] || this._createModule(e);
710
+ }
711
+ _createModule(e) {
712
+ const t = this._gpu.device;
713
+ return this._moduleCache[e] = t.createShaderModule({
714
+ code: e
715
+ }), this._moduleCache[e];
716
+ }
717
+ _generateBufferKey(e) {
718
+ const t = [];
719
+ let r = 0;
720
+ const s = Object.keys(e.attributes).sort();
721
+ for (let n = 0; n < s.length; n++) {
722
+ const o = e.attributes[s[n]];
723
+ t[r++] = o.offset, t[r++] = o.format, t[r++] = o.stride, t[r++] = o.instance;
724
+ }
725
+ const i = t.join("|");
726
+ return e._layoutKey = w(i, "geometry"), e._layoutKey;
727
+ }
728
+ _generateAttributeLocationsKey(e) {
729
+ const t = [];
730
+ let r = 0;
731
+ const s = Object.keys(e.attributeData).sort();
732
+ for (let n = 0; n < s.length; n++) {
733
+ const o = e.attributeData[s[n]];
734
+ t[r++] = o.location;
735
+ }
736
+ const i = t.join("|");
737
+ return e._attributeLocationsKey = w(i, "programAttributes"), e._attributeLocationsKey;
738
+ }
739
+ /**
740
+ * Returns a hash of buffer names mapped to bind locations.
741
+ * This is used to bind the correct buffer to the correct location in the shader.
742
+ * @param geometry - The geometry where to get the buffer names
743
+ * @param program - The program where to get the buffer names
744
+ * @returns An object of buffer names mapped to the bind location.
745
+ */
746
+ getBufferNamesToBind(e, t) {
747
+ const r = e._layoutKey << 16 | t._attributeLocationsKey;
748
+ if (this._bindingNamesCache[r]) return this._bindingNamesCache[r];
749
+ const s = this._createVertexBufferLayouts(e, t), i = /* @__PURE__ */ Object.create(null), n = t.attributeData;
750
+ for (let o = 0; o < s.length; o++) {
751
+ const c = Object.values(s[o].attributes)[0].shaderLocation;
752
+ for (const f in n)
753
+ if (n[f].location === c) {
754
+ i[o] = f;
755
+ break;
756
+ }
757
+ }
758
+ return this._bindingNamesCache[r] = i, i;
759
+ }
760
+ _createVertexBufferLayouts(e, t) {
761
+ t._attributeLocationsKey || this._generateAttributeLocationsKey(t);
762
+ const r = e._layoutKey << 16 | t._attributeLocationsKey;
763
+ if (this._bufferLayoutsCache[r])
764
+ return this._bufferLayoutsCache[r];
765
+ const s = [];
766
+ return e.buffers.forEach((i) => {
767
+ const n = {
768
+ arrayStride: 0,
769
+ stepMode: "vertex",
770
+ attributes: []
771
+ }, o = n.attributes;
772
+ for (const u in t.attributeData) {
773
+ const c = e.attributes[u];
774
+ (c.divisor ?? 1) !== 1 && v(`Attribute ${u} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`), c.buffer === i && (n.arrayStride = c.stride, n.stepMode = c.instance ? "instance" : "vertex", o.push({
775
+ shaderLocation: t.attributeData[u].location,
776
+ offset: c.offset,
777
+ format: c.format
778
+ }));
779
+ }
780
+ o.length && s.push(n);
781
+ }), this._bufferLayoutsCache[r] = s, s;
782
+ }
783
+ _updatePipeHash() {
784
+ const e = ze(
785
+ this._stencilMode,
786
+ this._multisampleCount,
787
+ this._colorMask,
788
+ this._depthStencilAttachment,
789
+ this._colorTargetCount
790
+ );
791
+ this._pipeStateCaches[e] || (this._pipeStateCaches[e] = /* @__PURE__ */ Object.create(null)), this._pipeCache = this._pipeStateCaches[e];
792
+ }
793
+ destroy() {
794
+ this._renderer = null, this._bufferLayoutsCache = null;
795
+ }
796
+ }
797
+ J.extension = {
798
+ type: [l.WebGPUSystem],
799
+ name: "pipeline"
800
+ };
801
+ class Fe {
802
+ constructor() {
803
+ this.contexts = [], this.msaaTextures = [], this.msaaSamples = 1;
804
+ }
805
+ }
806
+ class Oe {
807
+ init(e, t) {
808
+ this._renderer = e, this._renderTargetSystem = t;
809
+ }
810
+ copyToTexture(e, t, r, s, i) {
811
+ const n = this._renderer, o = this._getGpuColorTexture(
812
+ e
813
+ ), u = n.texture.getGpuSource(
814
+ t.source
815
+ );
816
+ return n.encoder.commandEncoder.copyTextureToTexture(
817
+ {
818
+ texture: o,
819
+ origin: r
820
+ },
821
+ {
822
+ texture: u,
823
+ origin: i
824
+ },
825
+ s
826
+ ), t;
827
+ }
828
+ startRenderPass(e, t = !0, r, s, i = 0, n = 0) {
829
+ var f, h;
830
+ const u = this._renderTargetSystem.getGpuRenderTarget(e);
831
+ if (n !== 0 && ((f = u.msaaTextures) != null && f.length))
832
+ throw new Error("[RenderTargetSystem] Rendering to array layers is not supported with MSAA render targets.");
833
+ if (i > 0 && ((h = u.msaaTextures) != null && h.length))
834
+ throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");
835
+ const c = this.getDescriptor(e, t, r, i, n);
836
+ u.descriptor = c, this._renderer.pipeline.setRenderTarget(u), this._renderer.encoder.beginRenderPass(u), this._renderer.encoder.setViewport(s);
837
+ }
838
+ finishRenderPass() {
839
+ this._renderer.encoder.endRenderPass();
840
+ }
841
+ /**
842
+ * returns the gpu texture for the first color texture in the render target
843
+ * mainly used by the filter manager to get copy the texture for blending
844
+ * @param renderTarget
845
+ * @returns a gpu texture
846
+ */
847
+ _getGpuColorTexture(e) {
848
+ const t = this._renderTargetSystem.getGpuRenderTarget(e);
849
+ return t.contexts[0] ? t.contexts[0].getCurrentTexture() : this._renderer.texture.getGpuSource(
850
+ e.colorTextures[0].source
851
+ );
852
+ }
853
+ getDescriptor(e, t, r, s = 0, i = 0) {
854
+ typeof t == "boolean" && (t = t ? y.ALL : y.NONE);
855
+ const n = this._renderTargetSystem, o = n.getGpuRenderTarget(e), u = e.colorTextures.map(
856
+ (h, p) => {
857
+ const d = o.contexts[p];
858
+ let g, m;
859
+ if (d) {
860
+ if (i !== 0)
861
+ throw new Error("[RenderTargetSystem] Rendering to array layers is not supported for canvas targets.");
862
+ g = d.getCurrentTexture().createView();
863
+ } else
864
+ g = this._renderer.texture.getGpuSource(h).createView({
865
+ // Render attachments must be 2d views; for array/cube textures we select a single layer.
866
+ dimension: "2d",
867
+ baseMipLevel: s,
868
+ mipLevelCount: 1,
869
+ baseArrayLayer: i,
870
+ arrayLayerCount: 1
871
+ });
872
+ o.msaaTextures[p] && (m = g, g = this._renderer.texture.getTextureView(
873
+ o.msaaTextures[p]
874
+ ));
875
+ const x = t & y.COLOR ? "clear" : "load";
876
+ return r ?? (r = n.defaultClearColor), {
877
+ view: g,
878
+ resolveTarget: m,
879
+ clearValue: r,
880
+ storeOp: "store",
881
+ loadOp: x
882
+ };
883
+ }
884
+ );
885
+ let c;
886
+ if ((e.stencil || e.depth) && !e.depthStencilTexture && (e.ensureDepthStencilTexture(), e.depthStencilTexture.source.sampleCount = o.msaa ? 4 : 1), e.depthStencilTexture) {
887
+ const h = t & y.STENCIL ? "clear" : "load", p = t & y.DEPTH ? "clear" : "load";
888
+ c = {
889
+ view: this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView({
890
+ dimension: "2d",
891
+ baseMipLevel: s,
892
+ mipLevelCount: 1,
893
+ baseArrayLayer: i,
894
+ arrayLayerCount: 1
895
+ }),
896
+ stencilStoreOp: "store",
897
+ stencilLoadOp: h,
898
+ depthClearValue: 1,
899
+ depthLoadOp: p,
900
+ depthStoreOp: "store"
901
+ };
902
+ }
903
+ return {
904
+ colorAttachments: u,
905
+ depthStencilAttachment: c
906
+ };
907
+ }
908
+ clear(e, t = !0, r, s, i = 0, n = 0) {
909
+ if (!t) return;
910
+ const { gpu: o, encoder: u } = this._renderer, c = o.device;
911
+ if (u.commandEncoder === null) {
912
+ const h = c.createCommandEncoder(), p = this.getDescriptor(e, t, r, i, n), d = h.beginRenderPass(p);
913
+ d.setViewport(s.x, s.y, s.width, s.height, 0, 1), d.end();
914
+ const g = h.finish();
915
+ c.queue.submit([g]);
916
+ } else
917
+ this.startRenderPass(e, t, r, s, i, n);
918
+ }
919
+ initGpuRenderTarget(e) {
920
+ e.isRoot = !0;
921
+ const t = new Fe();
922
+ return t.colorTargetCount = e.colorTextures.length, e.colorTextures.forEach((r, s) => {
923
+ if (r instanceof pe) {
924
+ const i = r.resource.getContext(
925
+ "webgpu"
926
+ ), n = r.transparent ? "premultiplied" : "opaque";
927
+ try {
928
+ i.configure({
929
+ device: this._renderer.gpu.device,
930
+ usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,
931
+ format: "bgra8unorm",
932
+ alphaMode: n
933
+ });
934
+ } catch (o) {
935
+ console.error(o);
936
+ }
937
+ t.contexts[s] = i;
938
+ }
939
+ if (t.msaa = r.source.antialias, r.source.antialias) {
940
+ const i = new le({
941
+ width: 0,
942
+ height: 0,
943
+ sampleCount: 4,
944
+ arrayLayerCount: r.source.arrayLayerCount
945
+ });
946
+ t.msaaTextures[s] = i;
947
+ }
948
+ }), t.msaa && (t.msaaSamples = 4, e.depthStencilTexture && (e.depthStencilTexture.source.sampleCount = 4)), t;
949
+ }
950
+ destroyGpuRenderTarget(e) {
951
+ e.contexts.forEach((t) => {
952
+ t.unconfigure();
953
+ }), e.msaaTextures.forEach((t) => {
954
+ t.destroy();
955
+ }), e.msaaTextures.length = 0, e.contexts.length = 0;
956
+ }
957
+ ensureDepthStencilTexture(e) {
958
+ const t = this._renderTargetSystem.getGpuRenderTarget(e);
959
+ e.depthStencilTexture && t.msaa && (e.depthStencilTexture.source.sampleCount = 4);
960
+ }
961
+ resizeGpuRenderTarget(e) {
962
+ const t = this._renderTargetSystem.getGpuRenderTarget(e);
963
+ t.width = e.width, t.height = e.height, t.msaa && e.colorTextures.forEach((r, s) => {
964
+ const i = t.msaaTextures[s];
965
+ i == null || i.resize(
966
+ r.source.width,
967
+ r.source.height,
968
+ r.source._resolution
969
+ );
970
+ });
971
+ }
972
+ }
973
+ class Z extends ve {
974
+ constructor(e) {
975
+ super(e), this.adaptor = new Oe(), this.adaptor.init(e, this);
976
+ }
977
+ }
978
+ Z.extension = {
979
+ type: [l.WebGPUSystem],
980
+ name: "renderTarget"
981
+ };
982
+ class Q {
983
+ constructor() {
984
+ this._gpuProgramData = /* @__PURE__ */ Object.create(null);
985
+ }
986
+ contextChange(e) {
987
+ this._gpu = e;
988
+ }
989
+ getProgramData(e) {
990
+ return this._gpuProgramData[e._layoutKey] || this._createGPUProgramData(e);
991
+ }
992
+ _createGPUProgramData(e) {
993
+ const t = this._gpu.device, r = e.gpuLayout.map((i) => t.createBindGroupLayout({ entries: i })), s = { bindGroupLayouts: r };
994
+ return this._gpuProgramData[e._layoutKey] = {
995
+ bindGroups: r,
996
+ pipeline: t.createPipelineLayout(s)
997
+ }, this._gpuProgramData[e._layoutKey];
998
+ }
999
+ destroy() {
1000
+ this._gpu = null, this._gpuProgramData = null;
1001
+ }
1002
+ }
1003
+ Q.extension = {
1004
+ type: [
1005
+ l.WebGPUSystem
1006
+ ],
1007
+ name: "shader"
1008
+ };
1009
+ const _ = {};
1010
+ _.normal = {
1011
+ alpha: {
1012
+ srcFactor: "one",
1013
+ dstFactor: "one-minus-src-alpha",
1014
+ operation: "add"
1015
+ },
1016
+ color: {
1017
+ srcFactor: "one",
1018
+ dstFactor: "one-minus-src-alpha",
1019
+ operation: "add"
1020
+ }
1021
+ };
1022
+ _.add = {
1023
+ alpha: {
1024
+ srcFactor: "src-alpha",
1025
+ dstFactor: "one-minus-src-alpha",
1026
+ operation: "add"
1027
+ },
1028
+ color: {
1029
+ srcFactor: "one",
1030
+ dstFactor: "one",
1031
+ operation: "add"
1032
+ }
1033
+ };
1034
+ _.multiply = {
1035
+ alpha: {
1036
+ srcFactor: "one",
1037
+ dstFactor: "one-minus-src-alpha",
1038
+ operation: "add"
1039
+ },
1040
+ color: {
1041
+ srcFactor: "dst",
1042
+ dstFactor: "one-minus-src-alpha",
1043
+ operation: "add"
1044
+ }
1045
+ };
1046
+ _.screen = {
1047
+ alpha: {
1048
+ srcFactor: "one",
1049
+ dstFactor: "one-minus-src-alpha",
1050
+ operation: "add"
1051
+ },
1052
+ color: {
1053
+ srcFactor: "one",
1054
+ dstFactor: "one-minus-src",
1055
+ operation: "add"
1056
+ }
1057
+ };
1058
+ _.overlay = {
1059
+ alpha: {
1060
+ srcFactor: "one",
1061
+ dstFactor: "one-minus-src-alpha",
1062
+ operation: "add"
1063
+ },
1064
+ color: {
1065
+ srcFactor: "one",
1066
+ dstFactor: "one-minus-src",
1067
+ operation: "add"
1068
+ }
1069
+ };
1070
+ _.none = {
1071
+ alpha: {
1072
+ srcFactor: "one",
1073
+ dstFactor: "one-minus-src-alpha",
1074
+ operation: "add"
1075
+ },
1076
+ color: {
1077
+ srcFactor: "zero",
1078
+ dstFactor: "zero",
1079
+ operation: "add"
1080
+ }
1081
+ };
1082
+ _["normal-npm"] = {
1083
+ alpha: {
1084
+ srcFactor: "one",
1085
+ dstFactor: "one-minus-src-alpha",
1086
+ operation: "add"
1087
+ },
1088
+ color: {
1089
+ srcFactor: "src-alpha",
1090
+ dstFactor: "one-minus-src-alpha",
1091
+ operation: "add"
1092
+ }
1093
+ };
1094
+ _["add-npm"] = {
1095
+ alpha: {
1096
+ srcFactor: "one",
1097
+ dstFactor: "one",
1098
+ operation: "add"
1099
+ },
1100
+ color: {
1101
+ srcFactor: "src-alpha",
1102
+ dstFactor: "one",
1103
+ operation: "add"
1104
+ }
1105
+ };
1106
+ _["screen-npm"] = {
1107
+ alpha: {
1108
+ srcFactor: "one",
1109
+ dstFactor: "one-minus-src-alpha",
1110
+ operation: "add"
1111
+ },
1112
+ color: {
1113
+ srcFactor: "src-alpha",
1114
+ dstFactor: "one-minus-src",
1115
+ operation: "add"
1116
+ }
1117
+ };
1118
+ _.erase = {
1119
+ alpha: {
1120
+ srcFactor: "zero",
1121
+ dstFactor: "one-minus-src-alpha",
1122
+ operation: "add"
1123
+ },
1124
+ color: {
1125
+ srcFactor: "zero",
1126
+ dstFactor: "one-minus-src",
1127
+ operation: "add"
1128
+ }
1129
+ };
1130
+ _.min = {
1131
+ alpha: {
1132
+ srcFactor: "one",
1133
+ dstFactor: "one",
1134
+ operation: "min"
1135
+ },
1136
+ color: {
1137
+ srcFactor: "one",
1138
+ dstFactor: "one",
1139
+ operation: "min"
1140
+ }
1141
+ };
1142
+ _.max = {
1143
+ alpha: {
1144
+ srcFactor: "one",
1145
+ dstFactor: "one",
1146
+ operation: "max"
1147
+ },
1148
+ color: {
1149
+ srcFactor: "one",
1150
+ dstFactor: "one",
1151
+ operation: "max"
1152
+ }
1153
+ };
1154
+ class ee {
1155
+ constructor() {
1156
+ this.defaultState = new A(), this.defaultState.blend = !0;
1157
+ }
1158
+ contextChange(e) {
1159
+ this.gpu = e;
1160
+ }
1161
+ /**
1162
+ * Gets the blend mode data for the current state
1163
+ * @param state - The state to get the blend mode from
1164
+ * @param count - The number of color targets to create
1165
+ */
1166
+ getColorTargets(e, t) {
1167
+ const r = _[e.blendMode] || _.normal, s = [], i = {
1168
+ format: "bgra8unorm",
1169
+ writeMask: 0,
1170
+ blend: r
1171
+ };
1172
+ for (let n = 0; n < t; n++)
1173
+ s[n] = i;
1174
+ return s;
1175
+ }
1176
+ destroy() {
1177
+ this.gpu = null;
1178
+ }
1179
+ }
1180
+ ee.extension = {
1181
+ type: [
1182
+ l.WebGPUSystem
1183
+ ],
1184
+ name: "state"
1185
+ };
1186
+ const Ie = {
1187
+ type: "image",
1188
+ upload(a, e, t, r = 0) {
1189
+ const s = a.resource, i = (a.pixelWidth | 0) * (a.pixelHeight | 0), n = s.byteLength / i;
1190
+ t.device.queue.writeTexture(
1191
+ { texture: e, origin: { x: 0, y: 0, z: r } },
1192
+ s,
1193
+ {
1194
+ offset: 0,
1195
+ rowsPerImage: a.pixelHeight,
1196
+ bytesPerRow: a.pixelWidth * n
1197
+ },
1198
+ {
1199
+ width: a.pixelWidth,
1200
+ height: a.pixelHeight,
1201
+ depthOrArrayLayers: 1
1202
+ }
1203
+ );
1204
+ }
1205
+ }, te = {
1206
+ "bc1-rgba-unorm": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },
1207
+ "bc2-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
1208
+ "bc3-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
1209
+ "bc7-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
1210
+ "etc1-rgb-unorm": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },
1211
+ "etc2-rgba8unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
1212
+ "astc-4x4-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 }
1213
+ }, We = { blockBytes: 4, blockWidth: 1, blockHeight: 1 }, He = {
1214
+ type: "compressed",
1215
+ upload(a, e, t, r = 0) {
1216
+ let s = a.pixelWidth, i = a.pixelHeight;
1217
+ const n = te[a.format] || We;
1218
+ for (let o = 0; o < a.resource.length; o++) {
1219
+ const u = a.resource[o], c = Math.ceil(s / n.blockWidth) * n.blockBytes;
1220
+ t.device.queue.writeTexture(
1221
+ {
1222
+ texture: e,
1223
+ mipLevel: o,
1224
+ origin: { x: 0, y: 0, z: r }
1225
+ },
1226
+ u,
1227
+ {
1228
+ offset: 0,
1229
+ bytesPerRow: c
1230
+ },
1231
+ {
1232
+ width: Math.ceil(s / n.blockWidth) * n.blockWidth,
1233
+ height: Math.ceil(i / n.blockHeight) * n.blockHeight,
1234
+ depthOrArrayLayers: 1
1235
+ }
1236
+ ), s = Math.max(s >> 1, 1), i = Math.max(i >> 1, 1);
1237
+ }
1238
+ }
1239
+ }, E = ["right", "left", "top", "bottom", "front", "back"];
1240
+ function Ve(a) {
1241
+ return {
1242
+ type: "cube",
1243
+ upload(e, t, r) {
1244
+ const s = e.faces;
1245
+ for (let i = 0; i < E.length; i++) {
1246
+ const n = E[i], o = s[n];
1247
+ (a[o.uploadMethodId] || a.image).upload(o, t, r, i);
1248
+ }
1249
+ }
1250
+ };
1251
+ }
1252
+ const re = {
1253
+ type: "image",
1254
+ upload(a, e, t, r = 0) {
1255
+ const s = a.resource;
1256
+ if (!s) return;
1257
+ if (globalThis.HTMLImageElement && s instanceof HTMLImageElement) {
1258
+ const u = B.get().createCanvas(s.width, s.height);
1259
+ u.getContext("2d").drawImage(s, 0, 0, s.width, s.height), a.resource = u, v("ImageSource: Image element passed, converting to canvas and replacing resource.");
1260
+ }
1261
+ const i = Math.min(e.width, a.resourceWidth || a.pixelWidth), n = Math.min(e.height, a.resourceHeight || a.pixelHeight), o = a.alphaMode === "premultiply-alpha-on-upload";
1262
+ t.device.queue.copyExternalImageToTexture(
1263
+ { source: s },
1264
+ { texture: e, origin: { x: 0, y: 0, z: r }, premultipliedAlpha: o },
1265
+ {
1266
+ width: i,
1267
+ height: n
1268
+ }
1269
+ );
1270
+ }
1271
+ }, Ne = {
1272
+ type: "video",
1273
+ upload(a, e, t, r) {
1274
+ re.upload(a, e, t, r);
1275
+ }
1276
+ };
1277
+ class je {
1278
+ constructor(e) {
1279
+ this.device = e, this.sampler = e.createSampler({ minFilter: "linear" }), this.pipelines = {};
1280
+ }
1281
+ _getMipmapPipeline(e) {
1282
+ let t = this.pipelines[e];
1283
+ return t || (this.mipmapShaderModule || (this.mipmapShaderModule = this.device.createShaderModule({
1284
+ code: (
1285
+ /* wgsl */
1286
+ `
1287
+ var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
1288
+ vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
1289
+
1290
+ struct VertexOutput {
1291
+ @builtin(position) position : vec4<f32>,
1292
+ @location(0) texCoord : vec2<f32>,
1293
+ };
1294
+
1295
+ @vertex
1296
+ fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
1297
+ var output : VertexOutput;
1298
+ output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
1299
+ output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
1300
+ return output;
1301
+ }
1302
+
1303
+ @group(0) @binding(0) var imgSampler : sampler;
1304
+ @group(0) @binding(1) var img : texture_2d<f32>;
1305
+
1306
+ @fragment
1307
+ fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
1308
+ return textureSample(img, imgSampler, texCoord);
1309
+ }
1310
+ `
1311
+ )
1312
+ })), t = this.device.createRenderPipeline({
1313
+ layout: "auto",
1314
+ vertex: {
1315
+ module: this.mipmapShaderModule,
1316
+ entryPoint: "vertexMain"
1317
+ },
1318
+ fragment: {
1319
+ module: this.mipmapShaderModule,
1320
+ entryPoint: "fragmentMain",
1321
+ targets: [{ format: e }]
1322
+ }
1323
+ }), this.pipelines[e] = t), t;
1324
+ }
1325
+ /**
1326
+ * Generates mipmaps for the given GPUTexture from the data in level 0.
1327
+ * @param {module:External.GPUTexture} texture - Texture to generate mipmaps for.
1328
+ * @returns {module:External.GPUTexture} - The originally passed texture
1329
+ */
1330
+ generateMipmap(e) {
1331
+ const t = this._getMipmapPipeline(e.format);
1332
+ if (e.dimension === "3d" || e.dimension === "1d")
1333
+ throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");
1334
+ let r = e;
1335
+ const s = e.depthOrArrayLayers || 1, i = e.usage & GPUTextureUsage.RENDER_ATTACHMENT;
1336
+ if (!i) {
1337
+ const u = {
1338
+ size: {
1339
+ width: Math.ceil(e.width / 2),
1340
+ height: Math.ceil(e.height / 2),
1341
+ depthOrArrayLayers: s
1342
+ },
1343
+ format: e.format,
1344
+ usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
1345
+ mipLevelCount: e.mipLevelCount - 1
1346
+ };
1347
+ r = this.device.createTexture(u);
1348
+ }
1349
+ const n = this.device.createCommandEncoder({}), o = t.getBindGroupLayout(0);
1350
+ for (let u = 0; u < s; ++u) {
1351
+ let c = e.createView({
1352
+ baseMipLevel: 0,
1353
+ mipLevelCount: 1,
1354
+ dimension: "2d",
1355
+ baseArrayLayer: u,
1356
+ arrayLayerCount: 1
1357
+ }), f = i ? 1 : 0;
1358
+ for (let h = 1; h < e.mipLevelCount; ++h) {
1359
+ const p = r.createView({
1360
+ baseMipLevel: f++,
1361
+ mipLevelCount: 1,
1362
+ dimension: "2d",
1363
+ baseArrayLayer: u,
1364
+ arrayLayerCount: 1
1365
+ }), d = n.beginRenderPass({
1366
+ colorAttachments: [{
1367
+ view: p,
1368
+ storeOp: "store",
1369
+ loadOp: "clear",
1370
+ clearValue: { r: 0, g: 0, b: 0, a: 0 }
1371
+ }]
1372
+ }), g = this.device.createBindGroup({
1373
+ layout: o,
1374
+ entries: [{
1375
+ binding: 0,
1376
+ resource: this.sampler
1377
+ }, {
1378
+ binding: 1,
1379
+ resource: c
1380
+ }]
1381
+ });
1382
+ d.setPipeline(t), d.setBindGroup(0, g), d.draw(3, 1, 0, 0), d.end(), c = p;
1383
+ }
1384
+ }
1385
+ if (!i) {
1386
+ const u = {
1387
+ width: Math.ceil(e.width / 2),
1388
+ height: Math.ceil(e.height / 2),
1389
+ depthOrArrayLayers: s
1390
+ };
1391
+ for (let c = 1; c < e.mipLevelCount; ++c)
1392
+ n.copyTextureToTexture({
1393
+ texture: r,
1394
+ mipLevel: c - 1
1395
+ }, {
1396
+ texture: e,
1397
+ mipLevel: c
1398
+ }, u), u.width = Math.ceil(u.width / 2), u.height = Math.ceil(u.height / 2);
1399
+ }
1400
+ return this.device.queue.submit([n.finish()]), i || r.destroy(), e;
1401
+ }
1402
+ }
1403
+ class Ke {
1404
+ constructor(e) {
1405
+ this.textureView = null, this.gpuTexture = e;
1406
+ }
1407
+ /** Destroys this GPU data instance. */
1408
+ destroy() {
1409
+ this.gpuTexture.destroy(), this.textureView = null, this.gpuTexture = null;
1410
+ }
1411
+ }
1412
+ class se {
1413
+ constructor(e) {
1414
+ this._gpuSamplers = /* @__PURE__ */ Object.create(null), this._bindGroupHash = /* @__PURE__ */ Object.create(null), this._renderer = e, e.gc.addCollection(this, "_bindGroupHash", "hash"), this._managedTextures = new D({
1415
+ renderer: e,
1416
+ type: "resource",
1417
+ onUnload: this.onSourceUnload.bind(this),
1418
+ name: "gpuTextureSource"
1419
+ });
1420
+ const t = {
1421
+ image: re,
1422
+ buffer: Ie,
1423
+ video: Ne,
1424
+ compressed: He
1425
+ };
1426
+ this._uploads = {
1427
+ ...t,
1428
+ cube: Ve(t)
1429
+ };
1430
+ }
1431
+ /**
1432
+ * @deprecated since 8.15.0
1433
+ */
1434
+ get managedTextures() {
1435
+ return Object.values(this._managedTextures.items);
1436
+ }
1437
+ contextChange(e) {
1438
+ this._gpu = e;
1439
+ }
1440
+ /**
1441
+ * Initializes a texture source, if it has already been initialized nothing will happen.
1442
+ * @param source - The texture source to initialize.
1443
+ * @returns The initialized texture source.
1444
+ */
1445
+ initSource(e) {
1446
+ var t;
1447
+ return ((t = e._gpuData[this._renderer.uid]) == null ? void 0 : t.gpuTexture) || this._initSource(e);
1448
+ }
1449
+ _initSource(e) {
1450
+ if (e.autoGenerateMipmaps) {
1451
+ const c = Math.max(e.pixelWidth, e.pixelHeight);
1452
+ e.mipLevelCount = Math.floor(Math.log2(c)) + 1;
1453
+ }
1454
+ let t = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST;
1455
+ e.uploadMethodId !== "compressed" && (t |= GPUTextureUsage.RENDER_ATTACHMENT, t |= GPUTextureUsage.COPY_SRC);
1456
+ const r = te[e.format] || { blockWidth: 1, blockHeight: 1 }, s = Math.ceil(e.pixelWidth / r.blockWidth) * r.blockWidth, i = Math.ceil(e.pixelHeight / r.blockHeight) * r.blockHeight, n = {
1457
+ label: e.label,
1458
+ size: { width: s, height: i, depthOrArrayLayers: e.arrayLayerCount },
1459
+ format: e.format,
1460
+ sampleCount: e.sampleCount,
1461
+ mipLevelCount: e.mipLevelCount,
1462
+ dimension: e.dimension,
1463
+ usage: t
1464
+ }, o = this._gpu.device.createTexture(n);
1465
+ return e._gpuData[this._renderer.uid] = new Ke(o), this._managedTextures.add(e) && (e.on("update", this.onSourceUpdate, this), e.on("resize", this.onSourceResize, this), e.on("updateMipmaps", this.onUpdateMipmaps, this)), this.onSourceUpdate(e), o;
1466
+ }
1467
+ onSourceUpdate(e) {
1468
+ const t = this.getGpuSource(e);
1469
+ t && (this._uploads[e.uploadMethodId] && this._uploads[e.uploadMethodId].upload(e, t, this._gpu), e.autoGenerateMipmaps && e.mipLevelCount > 1 && this.onUpdateMipmaps(e));
1470
+ }
1471
+ onUpdateMipmaps(e) {
1472
+ this._mipmapGenerator || (this._mipmapGenerator = new je(this._gpu.device));
1473
+ const t = this.getGpuSource(e);
1474
+ this._mipmapGenerator.generateMipmap(t);
1475
+ }
1476
+ onSourceUnload(e) {
1477
+ e.off("update", this.onSourceUpdate, this), e.off("resize", this.onSourceResize, this), e.off("updateMipmaps", this.onUpdateMipmaps, this);
1478
+ }
1479
+ onSourceResize(e) {
1480
+ e._gcLastUsed = this._renderer.gc.now;
1481
+ const t = e._gpuData[this._renderer.uid], r = t == null ? void 0 : t.gpuTexture;
1482
+ r ? (r.width !== e.pixelWidth || r.height !== e.pixelHeight) && (t.destroy(), this._bindGroupHash[e.uid] = null, e._gpuData[this._renderer.uid] = null, this.initSource(e)) : this.initSource(e);
1483
+ }
1484
+ _initSampler(e) {
1485
+ return this._gpuSamplers[e._resourceId] = this._gpu.device.createSampler(e), this._gpuSamplers[e._resourceId];
1486
+ }
1487
+ getGpuSampler(e) {
1488
+ return this._gpuSamplers[e._resourceId] || this._initSampler(e);
1489
+ }
1490
+ getGpuSource(e) {
1491
+ var t;
1492
+ return e._gcLastUsed = this._renderer.gc.now, ((t = e._gpuData[this._renderer.uid]) == null ? void 0 : t.gpuTexture) || this.initSource(e);
1493
+ }
1494
+ /**
1495
+ * this returns s bind group for a specific texture, the bind group contains
1496
+ * - the texture source
1497
+ * - the texture style
1498
+ * - the texture matrix
1499
+ * This is cached so the bind group should only be created once per texture
1500
+ * @param texture - the texture you want the bindgroup for
1501
+ * @returns the bind group for the texture
1502
+ */
1503
+ getTextureBindGroup(e) {
1504
+ return this._bindGroupHash[e.uid] || this._createTextureBindGroup(e);
1505
+ }
1506
+ _createTextureBindGroup(e) {
1507
+ const t = e.source;
1508
+ return this._bindGroupHash[e.uid] = new k({
1509
+ 0: t,
1510
+ 1: t.style,
1511
+ 2: new z({
1512
+ uTextureMatrix: { type: "mat3x3<f32>", value: e.textureMatrix.mapCoord }
1513
+ })
1514
+ }), this._bindGroupHash[e.uid];
1515
+ }
1516
+ getTextureView(e) {
1517
+ const t = e.source;
1518
+ t._gcLastUsed = this._renderer.gc.now;
1519
+ let r = t._gpuData[this._renderer.uid];
1520
+ return r || (this.initSource(t), r = t._gpuData[this._renderer.uid]), r.textureView || (r.textureView = r.gpuTexture.createView({ dimension: t.viewDimension })), r.textureView;
1521
+ }
1522
+ generateCanvas(e) {
1523
+ const t = this._renderer, r = t.gpu.device.createCommandEncoder(), s = B.get().createCanvas();
1524
+ s.width = e.source.pixelWidth, s.height = e.source.pixelHeight;
1525
+ const i = s.getContext("webgpu");
1526
+ return i.configure({
1527
+ device: t.gpu.device,
1528
+ usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC,
1529
+ format: B.get().getNavigator().gpu.getPreferredCanvasFormat(),
1530
+ alphaMode: "premultiplied"
1531
+ }), r.copyTextureToTexture({
1532
+ texture: t.texture.getGpuSource(e.source),
1533
+ origin: {
1534
+ x: 0,
1535
+ y: 0
1536
+ }
1537
+ }, {
1538
+ texture: i.getCurrentTexture()
1539
+ }, {
1540
+ width: s.width,
1541
+ height: s.height
1542
+ }), t.gpu.device.queue.submit([r.finish()]), s;
1543
+ }
1544
+ getPixels(e) {
1545
+ const t = this.generateCanvas(e), r = M.getOptimalCanvasAndContext(t.width, t.height), s = r.context;
1546
+ s.drawImage(t, 0, 0);
1547
+ const { width: i, height: n } = t, o = s.getImageData(0, 0, i, n), u = new Uint8ClampedArray(o.data.buffer);
1548
+ return M.returnCanvasAndContext(r), { pixels: u, width: i, height: n };
1549
+ }
1550
+ destroy() {
1551
+ this._managedTextures.destroy();
1552
+ for (const e of Object.keys(this._bindGroupHash)) {
1553
+ const t = Number(e), r = this._bindGroupHash[t];
1554
+ r == null || r.destroy();
1555
+ }
1556
+ this._renderer = null, this._gpu = null, this._mipmapGenerator = null, this._gpuSamplers = null, this._bindGroupHash = null;
1557
+ }
1558
+ }
1559
+ se.extension = {
1560
+ type: [
1561
+ l.WebGPUSystem
1562
+ ],
1563
+ name: "texture"
1564
+ };
1565
+ class ie {
1566
+ constructor() {
1567
+ this._maxTextures = 0;
1568
+ }
1569
+ contextChange(e) {
1570
+ const t = new z({
1571
+ uTransformMatrix: { value: new F(), type: "mat3x3<f32>" },
1572
+ uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
1573
+ uRound: { value: 0, type: "f32" }
1574
+ });
1575
+ this._maxTextures = e.limits.maxBatchableTextures;
1576
+ const r = O({
1577
+ name: "graphics",
1578
+ bits: [
1579
+ fe,
1580
+ ge(this._maxTextures),
1581
+ Se,
1582
+ I
1583
+ ]
1584
+ });
1585
+ this.shader = new W({
1586
+ gpuProgram: r,
1587
+ resources: {
1588
+ // added on the fly!
1589
+ localUniforms: t
1590
+ }
1591
+ });
1592
+ }
1593
+ execute(e, t) {
1594
+ const r = t.context, s = r.customShader || this.shader, i = e.renderer, n = i.graphicsContext, {
1595
+ batcher: o,
1596
+ instructions: u
1597
+ } = n.getContextRenderData(r), c = i.encoder;
1598
+ c.setGeometry(o.geometry, s.gpuProgram);
1599
+ const f = i.globalUniforms.bindGroup;
1600
+ c.setBindGroup(0, f, s.gpuProgram);
1601
+ const h = i.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms, !0);
1602
+ c.setBindGroup(2, h, s.gpuProgram);
1603
+ const p = u.instructions;
1604
+ let d = null;
1605
+ for (let g = 0; g < u.instructionSize; g++) {
1606
+ const m = p[g];
1607
+ if (m.topology !== d && (d = m.topology, c.setPipelineFromGeometryProgramAndState(
1608
+ o.geometry,
1609
+ s.gpuProgram,
1610
+ e.state,
1611
+ m.topology
1612
+ )), s.groups[1] = m.bindGroup, !m.gpuBindGroup) {
1613
+ const x = m.textures;
1614
+ m.bindGroup = L(
1615
+ x.textures,
1616
+ x.count,
1617
+ this._maxTextures
1618
+ ), m.gpuBindGroup = i.bindGroup.getBindGroup(
1619
+ m.bindGroup,
1620
+ s.gpuProgram,
1621
+ 1
1622
+ );
1623
+ }
1624
+ c.setBindGroup(1, m.bindGroup, s.gpuProgram), c.renderPassEncoder.drawIndexed(m.size, 1, m.start);
1625
+ }
1626
+ }
1627
+ destroy() {
1628
+ this.shader.destroy(!0), this.shader = null;
1629
+ }
1630
+ }
1631
+ ie.extension = {
1632
+ type: [
1633
+ l.WebGPUPipesAdaptor
1634
+ ],
1635
+ name: "graphics"
1636
+ };
1637
+ class ne {
1638
+ init() {
1639
+ const e = O({
1640
+ name: "mesh",
1641
+ bits: [
1642
+ Te,
1643
+ Ce,
1644
+ I
1645
+ ]
1646
+ });
1647
+ this._shader = new W({
1648
+ gpuProgram: e,
1649
+ resources: {
1650
+ uTexture: R.EMPTY._source,
1651
+ uSampler: R.EMPTY._source.style,
1652
+ textureUniforms: {
1653
+ uTextureMatrix: { type: "mat3x3<f32>", value: new F() }
1654
+ }
1655
+ }
1656
+ });
1657
+ }
1658
+ execute(e, t) {
1659
+ const r = e.renderer;
1660
+ let s = t._shader;
1661
+ if (!s)
1662
+ s = this._shader, s.groups[2] = r.texture.getTextureBindGroup(t.texture);
1663
+ else if (!s.gpuProgram) {
1664
+ v("Mesh shader has no gpuProgram", t.shader);
1665
+ return;
1666
+ }
1667
+ const i = s.gpuProgram;
1668
+ if (i.autoAssignGlobalUniforms && (s.groups[0] = r.globalUniforms.bindGroup), i.autoAssignLocalUniforms) {
1669
+ const n = e.localUniforms;
1670
+ s.groups[1] = r.renderPipes.uniformBatch.getUniformBindGroup(n, !0);
1671
+ }
1672
+ r.encoder.draw({
1673
+ geometry: t._geometry,
1674
+ shader: s,
1675
+ state: t.state
1676
+ });
1677
+ }
1678
+ destroy() {
1679
+ this._shader.destroy(!0), this._shader = null;
1680
+ }
1681
+ }
1682
+ ne.extension = {
1683
+ type: [
1684
+ l.WebGPUPipesAdaptor
1685
+ ],
1686
+ name: "mesh"
1687
+ };
1688
+ const qe = [
1689
+ ...Ue,
1690
+ $,
1691
+ K,
1692
+ U,
1693
+ q,
1694
+ N,
1695
+ se,
1696
+ Z,
1697
+ Q,
1698
+ ee,
1699
+ J,
1700
+ j,
1701
+ Y,
1702
+ V
1703
+ ], Ye = [...we, X], $e = [H, ne, ie], oe = [], ae = [], ue = [];
1704
+ S.handleByNamedList(l.WebGPUSystem, oe);
1705
+ S.handleByNamedList(l.WebGPUPipes, ae);
1706
+ S.handleByNamedList(l.WebGPUPipesAdaptor, ue);
1707
+ S.add(...qe, ...Ye, ...$e);
1708
+ class tt extends me {
1709
+ constructor() {
1710
+ const e = {
1711
+ name: "webgpu",
1712
+ type: _e.WEBGPU,
1713
+ systems: oe,
1714
+ renderPipes: ae,
1715
+ renderPipeAdaptors: ue
1716
+ };
1717
+ super(e);
1718
+ }
1719
+ }
1720
+ export {
1721
+ tt as WebGPURenderer
1722
+ };
1723
+ //# sourceMappingURL=WebGPURenderer-BuntxQ1w.js.map