From: Chris Duncan Date: Sat, 8 Mar 2025 09:05:50 +0000 (-0800) Subject: Only set GPU lost promise callback if lost actually exists as a property on the device. X-Git-Tag: v3.1.0~9^2~33 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=5ee40b16f420ed9ed122034cba3de8f9919bb401;p=nano-pow.git Only set GPU lost promise callback if lost actually exists as a property on the device. --- diff --git a/src/classes/gpu.ts b/src/classes/gpu.ts index b00e727..c11476c 100644 --- a/src/classes/gpu.ts +++ b/src/classes/gpu.ts @@ -33,7 +33,7 @@ export class NanoPowGpu { if (adapter == null) throw new Error('WebGPU adapter refused by browser.') const device = await adapter.requestDevice() if (!(device instanceof GPUDevice)) throw new Error('WebGPU device failed to load.') - device.lost.then(this.reset) + device.lost?.then(this.reset) this.#device = device this.setup() } catch (err) {