diff --git a/src/platform/graphics/storage-buffer.js b/src/platform/graphics/storage-buffer.js index c414fac05b1..8e4e10546dc 100644 --- a/src/platform/graphics/storage-buffer.js +++ b/src/platform/graphics/storage-buffer.js @@ -38,7 +38,11 @@ class StorageBuffer { const usage = addStorageUsage ? (BUFFERUSAGE_STORAGE | bufferUsage) : bufferUsage; this.impl = graphicsDevice.createBufferImpl(usage); this.impl.allocate(graphicsDevice, byteSize); - this.device.buffers.add(this); + + // Note: not registered in device.buffers — storage buffer contents are not + // recoverable on device-lost (no CPU-side shadow, may be GPU-written), so + // they don't participate in the engine's auto lose/restore iteration. + // Consumers handling device-lost must destroy() and recreate storage buffers. this.adjustVramSizeTracking(graphicsDevice._vram, this.byteSize); } @@ -47,13 +51,8 @@ class StorageBuffer { * Frees resources associated with this storage buffer. */ destroy() { - - // stop tracking the buffer - const device = this.device; - device.buffers.delete(this); - - this.adjustVramSizeTracking(device._vram, -this.byteSize); - this.impl.destroy(device); + this.adjustVramSizeTracking(this.device._vram, -this.byteSize); + this.impl.destroy(this.device); } adjustVramSizeTracking(vram, size) {