]> zoso.dev Git - libnemo.git/commitdiff
Seems like loss of this context was indeed the issue, and reinitializing seems to...
authorChris Duncan <chris@zoso.dev>
Thu, 9 Jan 2025 23:26:10 +0000 (15:26 -0800)
committerChris Duncan <chris@zoso.dev>
Thu, 9 Jan 2025 23:26:10 +0000 (15:26 -0800)
global.min.js [moved from global.min.2.js with 99% similarity]
index.html
src/lib/nano-pow/classes/gpu.ts

similarity index 99%
rename from global.min.2.js
rename to global.min.js
index 6f0c1bd7180bc6b7c5cda8b7372db1abc7e7d501..9bb908c178d7a730564473865a6edf5986be7a9f 100644 (file)
@@ -11448,13 +11448,11 @@ var init_gpu = __esm({
         });
       }
       static reset(loss) {
-        console.dir(loss);
-        console.warn(`Device lost. Reinitializing...`);
-        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();
+        if (loss) console.dir(loss);
+        console.warn(`GPU device lost. Reinitializing...`);
+        _NanoPowGpu.#cpuBuffer?.destroy();
+        _NanoPowGpu.#gpuBuffer?.destroy();
+        _NanoPowGpu.#uboBuffer?.destroy();
         _NanoPowGpu.#busy = false;
         _NanoPowGpu.init();
       }
index 9d5b69e21e0a1af2f72e5354195d37a0edd72673..c9d4dbe1493cd116ed01066a3a87b6de29897dfc 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.2.js;hb=refs/heads/ios"></script>
+               src="https://zoso.dev/?p=libnemo.git;a=blob_plain;f=global.min.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 1903811209c759edeb9b37a48fbad48c6219edb9..36df721143af509feed37e1fa81b566d15d06b66 100644 (file)
@@ -94,13 +94,11 @@ export class NanoPowGpu {
        }
 
        static reset (loss?: GPUDeviceLostInfo): void {
-               console.dir(loss)
-               console.warn(`Device lost. Reinitializing...`)
-               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()
+               if (loss) console.dir(loss)
+               console.warn(`GPU device lost. Reinitializing...`)
+               NanoPowGpu.#cpuBuffer?.destroy()
+               NanoPowGpu.#gpuBuffer?.destroy()
+               NanoPowGpu.#uboBuffer?.destroy()
                NanoPowGpu.#busy = false
                NanoPowGpu.init()
        }
@@ -197,7 +195,6 @@ export class NanoPowGpu {
                                this.reset()
                                return this.search(hash, threshold)
                        }
-
                        if (data == null) throw new Error(`Failed to get data from buffer.`)
                        nonce = data.getBigUint64(0, true)
                        this.#busy = !data.getUint32(8)