Skip to content

Commit

Permalink
debugging in console
Browse files Browse the repository at this point in the history
  • Loading branch information
John Owens committed Oct 28, 2024
1 parent 4118a08 commit fd03cdd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions webgpufundamentals-timing.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class TimingHelper {
size: this.#querySet.count * 8,
usage: GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC,
});
} else {
console.log("TimingHelper(): cannot timestamp");
}
}

Expand Down Expand Up @@ -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");
Expand All @@ -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();
Expand Down

0 comments on commit fd03cdd

Please sign in to comment.