From: Chris Duncan Date: Tue, 11 Mar 2025 21:21:17 +0000 (-0700) Subject: Log options passed to functions if debugging. X-Git-Tag: v3.1.0~9^2~12 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=74ff0c858a6b1b24c238a287d41f6cbe77fb55d2;p=nano-pow.git Log options passed to functions if debugging. --- diff --git a/src/classes/gl.ts b/src/classes/gl.ts index 96349a5..4f23b69 100644 --- a/src/classes/gl.ts +++ b/src/classes/gl.ts @@ -354,6 +354,7 @@ export class NanoPowGl { ? this.#cores : options.effort this.#debug = !!(options?.debug) + if (this.#debug) console.log('search options', JSON.stringify(options)) /** Reset if user specified new level of effort */ if (this.#WORKLOAD !== 256 * effort) { @@ -434,6 +435,7 @@ export class NanoPowGl { ? 0xfffffff8 : options.threshold this.#debug = !!(options?.debug) + if (this.#debug) console.log('validate options', JSON.stringify(options)) if (NanoPowGl.#gl == null) throw new Error('WebGL 2 is required') if (this.#gl == null) throw new Error('WebGL 2 is required') diff --git a/src/classes/gpu.ts b/src/classes/gpu.ts index 2c08a06..dc9b00f 100644 --- a/src/classes/gpu.ts +++ b/src/classes/gpu.ts @@ -234,6 +234,7 @@ export class NanoPowGpu { ? 0x800 : options.effort * 0x100 this.#debug = !!(options?.debug) + if (this.#debug) console.log('search options', JSON.stringify(options)) // Ensure WebGPU is initialized before calculating let loads = 0 @@ -285,10 +286,11 @@ export class NanoPowGpu { }) } this.#busy = true - this.#debug = !!(options?.debug) const threshold = (typeof options?.threshold !== 'number' || options.threshold < 0x0 || options.threshold > 0xffffffff) ? 0xfffffff8 : options.threshold + this.#debug = !!(options?.debug) + if (this.#debug) console.log('validate options', JSON.stringify(options)) // Ensure WebGPU is initialized before calculating let loads = 0