]> zoso.dev Git - libnemo.git/commitdiff
Context of this is lost when device is lost, so try targeting class members instead...
authorChris Duncan <chris@zoso.dev>
Thu, 9 Jan 2025 23:17:10 +0000 (15:17 -0800)
committerChris Duncan <chris@zoso.dev>
Thu, 9 Jan 2025 23:17:10 +0000 (15:17 -0800)
global.min.2.js [moved from global.min.1.js with 99% similarity]
index.html
src/lib/nano-pow/classes/gpu.ts

similarity index 99%
rename from global.min.1.js
rename to global.min.2.js
index 0fcaafff3903d5d5b8e3019713248a48fc9a37d5..6f0c1bd7180bc6b7c5cda8b7372db1abc7e7d501 100644 (file)
@@ -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.
index 311288cc74a10e6253268997ac071a12ab8f50b4..9d5b69e21e0a1af2f72e5354195d37a0edd72673 100644 (file)
@@ -3,7 +3,7 @@
 <head>
        <link rel="icon" href="./favicon.ico">
        <script type="module"
-               src="https://zoso.dev/?p=libnemo.git;a=blob_plain;f=global.min.1.js;hb=refs/heads/ios"></script>
+               src="https://zoso.dev/?p=libnemo.git;a=blob_plain;f=global.min.2.js;hb=refs/heads/ios"></script>
        <!-- <script type="module" src="https://cdn.jsdelivr.net/npm/nano-webgl-pow@1.1.1/nano-webgl-pow.js"></script> -->
        <script type="module">
                (async () => {
index abb458d17b5fdfd8d2d09602113fc9e972137c13..1903811209c759edeb9b37a48fbad48c6219edb9 100644 (file)
@@ -96,13 +96,13 @@ export class NanoPowGpu {
        static reset (loss?: GPUDeviceLostInfo): void {
                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()
        }
 
        /**