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