From: Chris Duncan Date: Tue, 17 Dec 2024 22:36:19 +0000 (-0800) Subject: Set clear color in static initializer. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=0bf84d882e866a6c43845cd9fad1074273487159;p=libnemo.git Set clear color in static initializer. --- diff --git a/src/lib/workers/pow.ts b/src/lib/workers/pow.ts index 17bbf2c..3a6e359 100644 --- a/src/lib/workers/pow.ts +++ b/src/lib/workers/pow.ts @@ -238,6 +238,7 @@ void main() { static { this.#gl = new OffscreenCanvas(this.#WORKLOAD, this.#WORKLOAD).getContext('webgl2') if (this.#gl == null) throw new Error('WebGL 2 is required') + this.#gl.clearColor(0, 0, 0, 1) this.#program = this.#gl.createProgram() if (this.#program == null) throw new Error('Failed to create shader program') @@ -291,7 +292,6 @@ void main() { if (!/^[A-F-a-f0-9]{64}$/.test(hashHex)) throw new Error(`invalid_hash ${hashHex}`) if (typeof threshold !== 'number') throw new TypeError(`Invalid threshold ${threshold}`) if (this.#gl == null) throw new Error('WebGL 2 is required') - this.#gl.clearColor(0, 0, 0, 1) // Convert big-endian hash hex to buffer for use by shader const view = new DataView(new ArrayBuffer(32))