From: Chris Duncan Date: Wed, 15 Jan 2025 21:17:30 +0000 (-0800) Subject: Fix bug with GL validate. X-Git-Tag: v2.0.0~66 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=3740421d27846b435cc88ab20782803228052edb;p=nano-pow.git Fix bug with GL validate. --- diff --git a/src/classes/gl.ts b/src/classes/gl.ts index a6e376b..689bf99 100644 --- a/src/classes/gl.ts +++ b/src/classes/gl.ts @@ -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)