From fd03cddfc100a561d86a9f472f1a5bec3ae0bcd6 Mon Sep 17 00:00:00 2001 From: John Owens Date: Mon, 28 Oct 2024 15:29:00 -0700 Subject: [PATCH] debugging in console --- webgpufundamentals-timing.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webgpufundamentals-timing.js b/webgpufundamentals-timing.js index 7e42eca..0e84645 100644 --- a/webgpufundamentals-timing.js +++ b/webgpufundamentals-timing.js @@ -33,6 +33,8 @@ class TimingHelper { size: this.#querySet.count * 8, usage: GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC, }); + } else { + console.log("TimingHelper(): cannot timestamp"); } } @@ -121,6 +123,7 @@ class TimingHelper { async getResult() { if (!this.#canTimestamp) { + console.log("getResult(): Cannot timestamp"); return 0; } assert(this.#state === "wait for result", "must call resolveTiming"); @@ -132,6 +135,7 @@ class TimingHelper { /* I need to read about functional programming in JS to make below pretty */ const durations = []; for (var idx = 0; idx < times.length; idx += 2) { + console.log("Timestamps:", Number(times[idx + 1]), Number(times[idx])); durations.push(Number(times[idx + 1] - times[idx])); } resultBuffer.unmap();