From 74ff0c858a6b1b24c238a287d41f6cbe77fb55d2 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Tue, 11 Mar 2025 14:21:17 -0700 Subject: [PATCH] Log options passed to functions if debugging. --- src/classes/gl.ts | 2 ++ src/classes/gpu.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) 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 -- 2.34.1