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