From f1af2a0991f1a6681df616934014ebf8c513879c Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 9 Jan 2025 15:17:10 -0800 Subject: [PATCH] Context of this is lost when device is lost, so try targeting class members instead (unsure this will work since they are private). --- global.min.1.js => global.min.2.js | 16 ++++++++-------- index.html | 2 +- src/lib/nano-pow/classes/gpu.ts | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) rename global.min.1.js => global.min.2.js (99%) diff --git a/global.min.1.js b/global.min.2.js similarity index 99% rename from global.min.1.js rename to global.min.2.js index 0fcaaff..6f0c1bd 100644 --- a/global.min.1.js +++ b/global.min.2.js @@ -11370,7 +11370,7 @@ var init_gpu = __esm({ "src/lib/nano-pow/classes/gpu.ts"() { "use strict"; init_shaders(); - NanoPowGpu = class { + NanoPowGpu = class _NanoPowGpu { // Initialize WebGPU static #busy = false; static #device = null; @@ -11450,13 +11450,13 @@ var init_gpu = __esm({ static reset(loss) { console.dir(loss); console.warn(`Device lost. Reinitializing...`); - console.dir(this); - console.dir(this.#cpuBuffer); - if (this.#cpuBuffer) this.#cpuBuffer.destroy(); - if (this.#gpuBuffer) this.#gpuBuffer.destroy(); - if (this.#uboBuffer) this.#uboBuffer.destroy(); - this.#busy = false; - this.init(); + console.dir(_NanoPowGpu); + console.dir(_NanoPowGpu.#cpuBuffer); + if (_NanoPowGpu.#cpuBuffer) _NanoPowGpu.#cpuBuffer.destroy(); + if (_NanoPowGpu.#gpuBuffer) _NanoPowGpu.#gpuBuffer.destroy(); + if (_NanoPowGpu.#uboBuffer) _NanoPowGpu.#uboBuffer.destroy(); + _NanoPowGpu.#busy = false; + _NanoPowGpu.init(); } /** * Finds a nonce that satisfies the Nano proof-of-work requirements. diff --git a/index.html b/index.html index 311288c..9d5b69e 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ + src="https://zoso.dev/?p=libnemo.git;a=blob_plain;f=global.min.2.js;hb=refs/heads/ios">