From 5ee40b16f420ed9ed122034cba3de8f9919bb401 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sat, 8 Mar 2025 01:05:50 -0800 Subject: [PATCH] Only set GPU lost promise callback if lost actually exists as a property on the device. --- src/classes/gpu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.34.1