]> zoso.dev Git - nano-pow.git/commitdiff
Fix bug with GL validate.
authorChris Duncan <chris@zoso.dev>
Wed, 15 Jan 2025 21:17:30 +0000 (13:17 -0800)
committerChris Duncan <chris@zoso.dev>
Wed, 15 Jan 2025 21:17:30 +0000 (13:17 -0800)
src/classes/gl.ts

index a6e376b61ad159ded14554afc30b5a56261269b8..689bf99c8d17d84eaf4c67d748e4c5d6f7e51682 100644 (file)
@@ -216,10 +216,10 @@ export class NanoPowGl {
                if (this.#gl == null) throw new Error('WebGL 2 is required')
                if (!/^[A-Fa-f0-9]{16}$/.test(work)) throw new Error(`Invalid work ${work}`)
                if (!/^[A-Fa-f0-9]{64}$/.test(hash)) throw new Error(`Invalid hash ${hash}`)
+               const debug = !!(options?.debug)
                const threshold = (typeof options?.threshold !== 'number' || options.threshold < 0x0 || options.threshold > 0xffffffff)
                        ? 0xfffffff8
                        : options.threshold
-               const debug = !!(options?.debug)
 
                /** Set up uniform buffer object */
                const uboView = new DataView(new ArrayBuffer(144))
@@ -228,7 +228,7 @@ export class NanoPowGl {
                        uboView.setUint32(i * 2, parseInt(uint32, 16))
                }
                uboView.setUint32(128, threshold, true)
-               uboView.setFloat32(132, 1, true)
+               uboView.setFloat32(132, NanoPowGl.#WORKLOAD - 1, true)
                NanoPowGl.#gl.bindBuffer(NanoPowGl.#gl.UNIFORM_BUFFER, NanoPowGl.#uboBuffer)
                NanoPowGl.#gl.bufferSubData(NanoPowGl.#gl.UNIFORM_BUFFER, 0, uboView)
                NanoPowGl.#gl.bindBuffer(NanoPowGl.#gl.UNIFORM_BUFFER, null)