From f8e7bd56647b86b8e4e9429f2a6860921c32228a Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sun, 26 Jul 2026 02:23:31 -0700 Subject: [PATCH] Only run self-check once per API per page load. --- index.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 468c7ac..bdffb28 100644 --- a/index.html +++ b/index.html @@ -31,6 +31,13 @@ SPDX-License-Identifier: GPL-3.0-or-later document.getElementById('status').textContent = `READY` } + const selfChecked = { + webgpu: false, + webgl: false, + wasm: false, + cpu: false + } + const logger = new Logger() const glSize = (canvas => { @@ -105,7 +112,8 @@ SPDX-License-Identifier: GPL-3.0-or-later * @param {string} api */ async function selfCheck (api) { - document.getElementById('status').textContent = `RUNNING SELF-CHECK` + if (selfChecked[api]) return + document.getElementById('status').textContent = `RUNNING SELF-CHECK: ${api.toUpperCase()}` logger.log(`%cNanoPow`, 'color:green', 'Checking validation against known values') const options = { api, debug: true } // Generate once on load to compile shaders and initialize buffers @@ -195,7 +203,9 @@ SPDX-License-Identifier: GPL-3.0-or-later expect.push(isValid) } - if (!expect.every(result => result)) { + if (expect.every(result => result)) { + selfChecked[api] = true + } else { document.getElementById('status').textContent = `FAILED TO VALIDATE KNOWN VALUES, CHECK CONSOLE` throw new Error(`Validation is not working`) } -- 2.52.0