// WebGPU time loop: packs the set-up into storage buffers, compiles the four kernels and runs // the sub-steps of a chunk of audio samples as one command buffer. Works in a browser and under // Node with the `webgpu` (Dawn) package, which the tests use. import { HOLD_HEIGHT } from "../model/exciter.ts"; import { strainEnergies } from "../model/forces.ts"; import { invertMatrix } from "../model/linalg.ts"; import { DECIMATION_SPAN, DELAY_TAPS } from "../model/radiation.ts"; import { rawRigidModes } from "../model/shell.ts"; import type { Setup } from "../model/setup.ts"; import type { BackendOptions, BackendState, ChunkResult, Diagnostics, SimulatorBackend } from "../model/simulator.ts"; import { CHUNK_WORDS, ELEM_STRIDE, GATHER_ELEMS, HIT_HEADER, HITU_HEADER, NODE_STRIDE, RADCOEF_STRIDE, RAW_BASIS, STATE_FLOATS, SYNC_HEADER, WORKGROUP_NODES, shaderSource } from "./shaders.ts"; // evaluated lazily: under Node the WebGPU globals are installed after this module is imported const storageUsage = () => GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC; /** Largest per-chunk output buffer (acceleration rows or movie frames) we allocate on the GPU. */ const OUTPUT_BUDGET = 64e6; export class GpuSimulator implements SimulatorBackend { readonly kind = "gpu" as const; readonly setup: Setup; readonly device: GPUDevice; samplesDone = 0; private step = 0; private readonly G: number; private readonly GE: number; private readonly HF: number; private readonly HU: number; private readonly buffers: Record = {}; private readonly pipelines: Record = {}; private readonly bindGroups: Record = {}; private readonly chunkCapacity: number; readonly movieEvery: number; readonly dispEvery: number; readonly recordAcceleration: boolean; private readonly framesCapacity: number; private readonly dispCapacity: number; private readonly accRows: number; private readonly stagingPressure: GPUBuffer; private readonly stagingState: GPUBuffer; private readonly stagingHits: GPUBuffer; private readonly stagingHitsU: GPUBuffer; private readonly stagingMovie: GPUBuffer | null; private readonly stagingDisp: GPUBuffer | null; private readonly stagingAcc: GPUBuffer | null; private readonly rawFromOrtho: Float64Array; // p = L c: raw-mode partial sums from orthonormal-mode ones (6 x 6) private readonly radStateFloats: number; // accumulator slots, node history and the current sample's sub-step accelerations: the part of `rad` that is state constructor(device: GPUDevice, setup: Setup, chunkCapacity = 8192, opts: BackendOptions | number = {}) { if (typeof opts === "number") opts = { movieEvery: opts }; this.device = device; this.setup = setup; this.movieEvery = opts.movieEvery ?? 0; this.dispEvery = opts.dispEvery ?? 0; this.recordAcceleration = opts.recordAcceleration ?? false; const Nn = setup.mesh.n; // a chunk's outputs (movie frames, acceleration rows) stay under the budget if (this.movieEvery > 0) chunkCapacity = Math.max(128, Math.min(chunkCapacity, Math.floor((OUTPUT_BUDGET / (4 * Nn)) * this.movieEvery))); if (this.recordAcceleration) chunkCapacity = Math.max(128, Math.min(chunkCapacity, Math.floor(OUTPUT_BUDGET / (4 * Nn)) - 2)); this.chunkCapacity = chunkCapacity; this.framesCapacity = this.movieEvery > 0 ? Math.ceil(chunkCapacity / this.movieEvery) + 2 : 0; this.dispCapacity = this.dispEvery > 0 ? Math.ceil(chunkCapacity / this.dispEvery) + 2 : 0; this.accRows = this.recordAcceleration ? chunkCapacity + 2 : 0; const { mesh, shell: sh, schedule: sc, radiation: rad, substeps: M } = setup; const N = mesh.n, E = mesh.e, K = sc.K, P = sc.P, W = DECIMATION_SPAN, D = rad.ringLength, T = DELAY_TAPS; this.G = Math.ceil(N / WORKGROUP_NODES); this.GE = Math.ceil(E / GATHER_ELEMS); this.HF = HIT_HEADER + 5 * P; this.HU = HITU_HEADER + 3 * P; const G = this.G, HF = this.HF, HU = this.HU; this.radStateFloats = (W + D + M) * N; // ---- pack the set-up // field-major: field f of element e at f * E + e, of node n at f * N + n const elemF = new Float32Array(ELEM_STRIDE * E); for (let e = 0; e < E; e++) { const set = (f: number, x: number) => { elemF[f * E + e] = x; }; for (let i = 0; i < 3; i++) { set(i, mesh.Gx[3 * e + i]); set(3 + i, mesh.Gy[3 * e + i]); } set(6, mesh.area[e]); set(7, sh.z0x[e]); set(8, sh.z0y[e]); set(9, sh.Cm[3 * e]); set(10, sh.Cm[3 * e + 1]); set(11, sh.Cm[3 * e + 2]); set(12, 2 * setup.config.material.sigma1 * sh.rhoHA[e]); // upper triangle of K_e, symmetrised in float64 (it is symmetric to round-off) const K = sh.Ke.subarray(81 * e, 81 * e + 81); for (let i = 0, f = 13; i < 9; i++) for (let j = i; j < 9; j++) set(f++, 0.5 * (K[9 * i + j] + K[9 * j + i])); } const elemU = new Uint32Array(3 * E); elemU.set(mesh.tri); const nodeF = new Float32Array(NODE_STRIDE * N + W * M); // the shader evaluates the raw rigid modes from (X, Y, z0) and projects with the inverse of their // M-Gram matrix, which is the projection onto the M-orthonormal modes Rm without storing them const [cx, cy] = sh.rigidCentre; const gram = new Float64Array(36), rawFromOrtho = new Float64Array(36); for (let n = 0; n < N; n++) { const set = (f: number, x: number) => { nodeF[f * N + n] = x; }; const X = mesh.xy[2 * n] - cx, Y = mesh.xy[2 * n + 1] - cy, z = sh.z0Node[n]; for (let d = 0; d < 5; d++) { set(d, sh.Minv[5 * n + d]); set(5 + d, sh.M[5 * n + d]); } set(10, X); set(11, Y); set(12, z); for (let d = 0; d < 3; d++) set(13 + d, sh.normalNode[3 * n + d]); const r = rawRigidModes(X, Y, z); for (let a = 0; a < 6; a++) for (let d = 0; d < 5; d++) { const rm = r[a][d] * sh.M[5 * n + d]; if (rm === 0) continue; for (let b = 0; b < 6; b++) { gram[6 * a + b] += rm * r[b][d]; rawFromOrtho[6 * a + b] += rm * sh.Rm[(b * N + n) * 5 + d]; } } } this.rawFromOrtho = rawFromOrtho; nodeF.set(rad.taps, NODE_STRIDE * N); const adj = new Uint32Array(N + 1 + sh.adjEntries.length); adj.set(sh.adjOffsets); adj.set(sh.adjEntries, N + 1); const hitsF = new Float32Array(HF * K), hitsU = new Uint32Array(HU * K); for (let k = 0; k < K; k++) { const hf = HF * k, hu = HU * k; hitsF[hf] = sc.kPoint[k]; hitsF[hf + 1] = sc.alpha[k]; hitsF[hf + 2] = sc.mass[k]; hitsF[hf + 3] = sc.gap[k]; hitsF[hf + 4] = sc.velocity[k]; hitsF[hf + 5] = HOLD_HEIGHT; hitsF[hf + 6] = 0; hitsF[hf + 7] = 0; hitsF[hf + 8] = 0; for (let p = 0; p < P; p++) { for (let i = 0; i < 3; i++) { hitsF[hf + HIT_HEADER + 3 * p + i] = sc.weights[(k * P + p) * 3 + i]; hitsU[hu + HITU_HEADER + 3 * p + i] = sc.nodes[(k * P + p) * 3 + i]; } hitsF[hf + HIT_HEADER + 3 * P + p] = sc.offsets[k * P + p]; } hitsU[hu] = sc.releaseStep[k]; hitsU[hu + 1] = 0; } const radCoef = new Float32Array(RADCOEF_STRIDE * E); for (let e = 0; e < E; e++) { const b = RADCOEF_STRIDE * e; radCoef[b] = rad.coefF[e]; radCoef[b + 1] = rad.coefB[e]; radCoef[b + 2] = rad.i0F[e]; radCoef[b + 3] = rad.i0B[e]; for (let t = 0; t < T; t++) { radCoef[b + 4 + t] = rad.tapsF[e * T + t]; radCoef[b + 4 + T + t] = rad.tapsB[e * T + t]; } } const mk = (name: string, data: Float32Array | Uint32Array, usage = storageUsage()) => { const buf = device.createBuffer({ label: name, size: Math.max(16, data.byteLength), usage }); device.queue.writeBuffer(buf, 0, data.buffer, data.byteOffset, data.byteLength); this.buffers[name] = buf; return buf; }; const mkEmpty = (name: string, floats: number) => { const buf = device.createBuffer({ label: name, size: Math.max(16, 4 * floats), usage: storageUsage() }); this.buffers[name] = buf; return buf; }; mk("elemF", elemF); mk("elemU", elemU); mk("nodeF", nodeF); mk("adj", adj); mk("radCoef", radCoef); mk("hitsF", hitsF); mk("hitsU", hitsU); mkEmpty("state", STATE_FLOATS * N); mkEmpty("elemForce", 15 * E); mk("sync", Float32Array.from({ length: SYNC_HEADER + 2 * G * 12 }, (_, i) => (i === 2 ? RAW_BASIS : 0))); mkEmpty("rad", this.radStateFloats + this.accRows * N); mkEmpty("elemHist", D * E); mkEmpty("pressure", 2 * chunkCapacity * this.GE); // one partial sum per gather workgroup const uniform = (name: string) => { const b = device.createBuffer({ label: name, size: 4 * CHUNK_WORDS, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }); this.buffers[name] = b; return b; }; uniform("chunk"); uniform("chunkD"); const staging = (size: number) => device.createBuffer({ size: Math.max(16, size), usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST }); this.stagingPressure = staging(8 * chunkCapacity * this.GE); this.stagingState = staging(STATE_FLOATS * N * 4); this.stagingHits = staging(HF * K * 4); this.stagingHitsU = staging(HU * K * 4); this.stagingMovie = this.framesCapacity > 0 ? (mkEmpty("movie", this.framesCapacity * N), staging(this.framesCapacity * N * 4)) : null; this.stagingDisp = this.dispCapacity > 0 ? (mkEmpty("disp", this.dispCapacity * N), staging(this.dispCapacity * N * 4)) : null; this.stagingAcc = this.accRows > 0 ? staging(this.accRows * N * 4) : null; // ---- pipelines const module = device.createShaderModule({ code: shaderSource({ N, E, K, P, M, W, D, G, T, rigidGramInv: invertMatrix(gram, 6), accRows: this.accRows, dt: setup.dt, sigma0: setup.config.material.sigma0, nl: sh.nl }) }); type Kind = "read-only-storage" | "storage" | "uniform"; const bgl = (entries: [number, Kind][]) => device.createBindGroupLayout({ entries: entries.map(([binding, type]) => ({ binding, visibility: GPUShaderStage.COMPUTE, buffer: { type } })), }); const L0 = bgl([[0, "read-only-storage"], [1, "read-only-storage"], [2, "read-only-storage"], [3, "storage"], [4, "storage"], [5, "read-only-storage"], [6, "storage"]]); const L1 = bgl([[0, "storage"], [1, "read-only-storage"], [2, "read-only-storage"], [3, "read-only-storage"], [4, "storage"], [5, "storage"], [6, "storage"], [7, "storage"], [8, "uniform"]]); const L2 = bgl([[0, "read-only-storage"], [1, "read-only-storage"], [2, "read-only-storage"], [3, "storage"], [4, "uniform"], [5, "storage"], [6, "read-only-storage"]]); const L3 = bgl([[0, "read-only-storage"], [1, "storage"], [2, "uniform"], [3, "read-only-storage"]]); const empty = device.createBindGroupLayout({ entries: [] }); const mkPipe = (entryPoint: string, layouts: GPUBindGroupLayout[]) => device.createComputePipeline({ label: entryPoint, layout: device.createPipelineLayout({ bindGroupLayouts: layouts }), compute: { module, entryPoint }, }); this.pipelines.element = mkPipe("elementPass", [L0]); this.pipelines.node = mkPipe("nodePass", [empty, L1]); this.pipelines.gather = mkPipe("gatherPass", [empty, empty, L2]); if (this.framesCapacity > 0 || this.dispCapacity > 0) this.pipelines.capture = mkPipe("capturePass", [empty, empty, empty, L3]); const B = this.buffers; const bg = (layout: GPUBindGroupLayout, bufs: GPUBuffer[]) => device.createBindGroup({ layout, entries: bufs.map((buffer, binding) => ({ binding, resource: { buffer } })) }); this.bindGroups.element = bg(L0, [B.elemF, B.elemU, B.state, B.elemForce, B.hitsF, B.hitsU, B.sync]); this.bindGroups.node = bg(L1, [B.state, B.elemForce, B.nodeF, B.adj, B.hitsF, B.hitsU, B.sync, B.rad, B.chunk]); this.bindGroups.gather = bg(L2, [B.sync, B.rad, B.radCoef, B.pressure, B.chunk, B.elemHist, B.elemU]); if (this.framesCapacity > 0) this.bindGroups.capture = bg(L3, [B.state, B.movie, B.chunk, B.sync]); if (this.dispCapacity > 0) this.bindGroups.captureDisp = bg(L3, [B.state, B.disp, B.chunkD, B.sync]); this.bindGroups.empty = device.createBindGroup({ layout: empty, entries: [] }); } /** Audio sample finished by the node pass of sub-step n (the acceleration of s = n - 1), or -1 when none. */ private sampleDueAt(n: number): number { const M = this.setup.substeps, W = DECIMATION_SPAN; if (n < 1 || (n - 1) % M !== 0) return -1; const j = (n - 1) / M - W / 2; return j >= 0 ? j : -1; } get maxChunk() { return this.chunkCapacity; } private capture(pass: GPUComputePassEncoder, group: GPUBindGroup) { pass.setPipeline(this.pipelines.capture); pass.setBindGroup(0, this.bindGroups.empty); pass.setBindGroup(1, this.bindGroups.empty); pass.setBindGroup(2, this.bindGroups.empty); pass.setBindGroup(3, group); pass.dispatchWorkgroups(this.G); } private async readStaging(staging: GPUBuffer, bytes: number): Promise { await staging.mapAsync(GPUMapMode.READ, 0, bytes); const data = new Float32Array(staging.getMappedRange(0, bytes).slice(0)); staging.unmap(); return data; } async runChunk(nSamples: number): Promise { if (nSamples > this.chunkCapacity) throw new Error("chunk larger than the pressure buffer"); const { device, setup } = this, M = setup.substeps, E = setup.mesh.e, K = setup.schedule.K, N = setup.mesh.n; const n0 = this.step, n1 = n0 + nSamples * M; let base = -1, count = 0; for (let n = n0; n < n1; n++) { const j = this.sampleDueAt(n); if (j >= 0) { if (base < 0) base = j; count++; } } // frames captured in this chunk: the state at the start of sub-step n where n / M is a multiple of `every` const framesAt = (every: number) => { const out: number[] = []; if (every > 0) for (let n = n0; n < n1; n++) if (n % (M * every) === 0) out.push(n / M); return out; }; const frameSamples = framesAt(this.movieEvery), dispSamples = framesAt(this.dispEvery); const frameBase = frameSamples.length ? frameSamples[0] / this.movieEvery : 0, dispBase = dispSamples.length ? dispSamples[0] / this.dispEvery : 0; const accBase = base < 0 ? 0 : base, accRows = this.recordAcceleration ? Math.max(count, 0) : 0; device.queue.writeBuffer(this.buffers.chunk, 0, new Int32Array([accBase, Math.max(count, 1), frameBase, Math.max(this.movieEvery, 1), accBase, accRows, 0, 0])); device.queue.writeBuffer(this.buffers.chunkD, 0, new Int32Array([accBase, Math.max(count, 1), dispBase, Math.max(this.dispEvery, 1), accBase, accRows, 0, 0])); const enc = device.createCommandEncoder(); enc.clearBuffer(this.buffers.pressure); const pass = enc.beginComputePass(); const wgE = Math.ceil((E + K) / 64), wgN = this.G; for (let n = n0; n < n1; n++) { if (this.movieEvery > 0 && n % (M * this.movieEvery) === 0) this.capture(pass, this.bindGroups.capture); if (this.dispEvery > 0 && n % (M * this.dispEvery) === 0) this.capture(pass, this.bindGroups.captureDisp); pass.setPipeline(this.pipelines.element); pass.setBindGroup(0, this.bindGroups.element); pass.dispatchWorkgroups(wgE); pass.setPipeline(this.pipelines.node); pass.setBindGroup(0, this.bindGroups.empty); pass.setBindGroup(1, this.bindGroups.node); pass.dispatchWorkgroups(wgN); if (this.sampleDueAt(n) >= 0) { pass.setPipeline(this.pipelines.gather); pass.setBindGroup(0, this.bindGroups.empty); pass.setBindGroup(1, this.bindGroups.empty); pass.setBindGroup(2, this.bindGroups.gather); pass.dispatchWorkgroups(this.GE); } } pass.end(); const GE = this.GE; enc.copyBufferToBuffer(this.buffers.pressure, 0, this.stagingPressure, 0, 8 * this.chunkCapacity * GE); const nFrames = frameSamples.length, nDisp = dispSamples.length; if (nFrames > 0) enc.copyBufferToBuffer(this.buffers.movie, 0, this.stagingMovie!, 0, nFrames * N * 4); if (nDisp > 0) enc.copyBufferToBuffer(this.buffers.disp, 0, this.stagingDisp!, 0, nDisp * N * 4); if (accRows > 0) enc.copyBufferToBuffer(this.buffers.rad, this.radStateFloats * 4, this.stagingAcc!, 0, accRows * N * 4); device.queue.submit([enc.finish()]); this.step = n1; this.samplesDone += nSamples; const partial = await this.readStaging(this.stagingPressure, 8 * this.chunkCapacity * GE); const all = new Float32Array(2 * this.chunkCapacity); for (let i = 0; i < 2 * Math.max(count, 1); i++) { let s = 0; for (let g = 0; g < GE; g++) s += partial[i * GE + g]; all[i] = s; } const split = (data: Float32Array, k: number) => Array.from({ length: k }, (_, f) => data.slice(f * N, (f + 1) * N)); const frames = nFrames > 0 ? split(await this.readStaging(this.stagingMovie!, nFrames * N * 4), nFrames) : []; const dispFrames = nDisp > 0 ? split(await this.readStaging(this.stagingDisp!, nDisp * N * 4), nDisp) : []; const acceleration = this.recordAcceleration ? (accRows > 0 ? await this.readStaging(this.stagingAcc!, accRows * N * 4) : new Float32Array(0)) : null; const size = Math.max(count, 1); return { firstSample: base < 0 ? this.samplesDone : base, pressureFront: all.slice(0, count), pressureBack: all.slice(size, size + count), frames, frameSamples, acceleration, dispFrames, dispSamples }; } private async read(buffer: GPUBuffer, staging: GPUBuffer, bytes: number): Promise { const enc = this.device.createCommandEncoder(); enc.copyBufferToBuffer(buffer, 0, staging, 0, bytes); this.device.queue.submit([enc.finish()]); await staging.mapAsync(GPUMapMode.READ, 0, bytes); const out = staging.getMappedRange(0, bytes).slice(0); staging.unmap(); return out; } /** Read a whole buffer through a temporary staging buffer. */ private async readWhole(buffer: GPUBuffer, bytes: number): Promise { const staging = this.device.createBuffer({ size: Math.max(16, bytes), usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST }); try { return await this.read(buffer, staging, bytes); } finally { staging.destroy(); } } async diagnostics(): Promise { const { setup } = this, sh = setup.shell, N = setup.mesh.n, sc = setup.schedule, HF = this.HF, HU = this.HU; const st = new Float32Array(await this.read(this.buffers.state, this.stagingState, STATE_FLOATS * N * 4)); const hf = new Float32Array(await this.read(this.buffers.hitsF, this.stagingHits, Math.max(16, HF * sc.K * 4))); const hu = new Uint32Array(await this.read(this.buffers.hitsU, this.stagingHitsU, Math.max(16, HU * sc.K * 4))); let ke = 0, woh = 0; for (let i = 0; i < 5 * N; i++) ke += 0.5 * sh.M[i] * st[5 * N + i] * st[5 * N + i]; for (let n = 0; n < N; n++) woh = Math.max(woh, Math.abs(st[5 * n + 2] / sh.hNode[n])); const { membrane, bending } = strainEnergies(sh, st.subarray(0, 5 * N)); let ex = 0; const hits = []; for (let k = 0; k < sc.K; k++) { ex += 0.5 * hf[HF * k + 2] * hf[HF * k + 6] ** 2; hits.push({ peakForce: hf[HF * k + 8], contactTime: hu[HU * k + 1] * setup.dt, velocity: hf[HF * k + 6], height: hf[HF * k + 5] }); } return { time: this.step * setup.dt, kinetic: ke, membrane, bending, exciters: ex, maxWoverH: woh, hits }; } async displacement(): Promise { const N = this.setup.mesh.n; const st = new Float32Array(await this.read(this.buffers.state, this.stagingState, STATE_FLOATS * N * 4)); const w = new Float32Array(N); for (let n = 0; n < N; n++) w[n] = st[5 * n + 2]; return w; } async exportState(): Promise { const { setup } = this, N = setup.mesh.n, E = setup.mesh.e, K = setup.schedule.K, D = setup.radiation.ringLength; const B = this.buffers; return { kind: "gpu", step: this.step, samplesDone: this.samplesDone, arrays: { state: new Float32Array(await this.readWhole(B.state, STATE_FLOATS * N * 4)), sync: new Float32Array(await this.readWhole(B.sync, (SYNC_HEADER + 2 * this.G * 12) * 4)), hitsF: new Float32Array(await this.readWhole(B.hitsF, Math.max(16, this.HF * K * 4))).subarray(0, this.HF * K), hitsU: new Uint32Array(await this.readWhole(B.hitsU, Math.max(16, this.HU * K * 4))).subarray(0, this.HU * K), rad: new Float32Array(await this.readWhole(B.rad, this.radStateFloats * 4)), elemHist: new Float32Array(await this.readWhole(B.elemHist, D * E * 4)), } }; } async importState(st: BackendState): Promise { if (st.kind !== "gpu") throw new Error("state was written by another backend"); const { setup } = this, N = setup.mesh.n, E = setup.mesh.e, K = setup.schedule.K, D = setup.radiation.ringLength; const expect: Record = { state: STATE_FLOATS * N, sync: SYNC_HEADER + 2 * this.G * 12, hitsF: this.HF * K, hitsU: this.HU * K, rad: this.radStateFloats, elemHist: D * E }; // states written before the sub-step accelerations were kept per sample lack them; their accumulator // slots already hold the sample's earlier sub-steps, so zero accelerations continue them exactly const legacyRad = this.radStateFloats - setup.substeps * N; for (const [name, len] of Object.entries(expect)) { let a = st.arrays[name]; if (name === "rad" && a?.length === legacyRad) { const full = new Float32Array(len); full.set(a); a = full; } if (name === "sync" && a?.length === len && a[2] !== RAW_BASIS) a = this.syncToRawBasis(a as Float32Array); if (!a || a.length !== len) throw new Error(`state array ${name} is missing or has the wrong size`); this.device.queue.writeBuffer(this.buffers[name], 0, a.buffer, a.byteOffset, a.byteLength); } this.step = st.step; this.samplesDone = st.samplesDone; } /** A sync array of a state exported before step 3, whose partials are sums for the orthonormal modes, in the raw basis. */ private syncToRawBasis(old: Float32Array): Float32Array { const out = Float32Array.from(old), L = this.rawFromOrtho; out[2] = RAW_BASIS; for (let b = 0; b < 2 * this.G; b++) for (const o of [0, 6]) { const base = SYNC_HEADER + 12 * b + o; for (let a = 0; a < 6; a++) { let s = 0; for (let k = 0; k < 6; k++) s += L[6 * a + k] * old[base + k]; out[base + a] = s; } } return out; } /** The state buffer (q at offset 0, 5 floats per node), for a renderer that reads w directly. */ get stateBuffer(): GPUBuffer { return this.buffers.state; } dispose() { for (const b of Object.values(this.buffers)) b.destroy(); this.stagingPressure.destroy(); this.stagingState.destroy(); this.stagingHits.destroy(); this.stagingHitsU.destroy(); this.stagingMovie?.destroy(); this.stagingDisp?.destroy(); this.stagingAcc?.destroy(); } }