ugly-game 0.14.2 → 0.14.3
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/dist/assets/gpuProps.js +6 -1
- package/package.json +1 -1
package/dist/assets/gpuProps.js
CHANGED
|
@@ -435,7 +435,10 @@ export class GpuPropsRenderer {
|
|
|
435
435
|
p.colB.destroy();
|
|
436
436
|
p.uvB.destroy();
|
|
437
437
|
p.idxB.destroy();
|
|
438
|
-
|
|
438
|
+
// Only what this renderer allocated. See Packed.ownsTex — freeing a caller's GPUTexture makes
|
|
439
|
+
// a repeated setModels bind dead resources.
|
|
440
|
+
if (p.ownsTex)
|
|
441
|
+
p.tex?.destroy();
|
|
439
442
|
}
|
|
440
443
|
const mk = (d, u) => {
|
|
441
444
|
const b = dev.createBuffer({ size: d.byteLength, usage: u });
|
|
@@ -469,12 +472,14 @@ export class GpuPropsRenderer {
|
|
|
469
472
|
const verts = m.positions.length / 3;
|
|
470
473
|
// A GPUTexture is already uploaded and already mipped (the KTX2 path) — bind it directly.
|
|
471
474
|
// Only an ImageBitmap needs uploadAlbedo's hand-rolled half-scale mip chain.
|
|
475
|
+
const ownsTex = !!m.albedo && !(m.albedo instanceof GPUTexture);
|
|
472
476
|
const tex = m.albedo
|
|
473
477
|
? m.albedo instanceof GPUTexture
|
|
474
478
|
? m.albedo
|
|
475
479
|
: this.uploadAlbedo(m.albedo)
|
|
476
480
|
: null;
|
|
477
481
|
return {
|
|
482
|
+
ownsTex,
|
|
478
483
|
posB: mk(m.positions, U.VERTEX | U.COPY_DST),
|
|
479
484
|
nrmB: mk(m.normals, U.VERTEX | U.COPY_DST),
|
|
480
485
|
colB: mk(m.colors, U.VERTEX | U.COPY_DST),
|