Skip to content

Commit

Permalink
Fix timing info TimingHelper
Browse files Browse the repository at this point in the history
The code in the article was out of date compared
to the actual code
  • Loading branch information
greggman committed Sep 16, 2024
1 parent b329e2b commit a027b92
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions webgpu/lessons/webgpu-timing.md
Original file line number Diff line number Diff line change
Expand Up @@ -665,14 +665,16 @@ class TimingHelper {
constructor(device) {
this.#device = device;
this.#canTimestamp = device.features.has('timestamp-query');
this.#querySet = device.createQuerySet({
type: 'timestamp',
count: 2,
});
this.#resolveBuffer = device.createBuffer({
size: this.#querySet.count * 8,
usage: GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC,
});
if (this.#canTimestamp) {
this.#querySet = device.createQuerySet({
type: 'timestamp',
count: 2,
});
this.#resolveBuffer = device.createBuffer({
size: this.#querySet.count * 8,
usage: GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC,
});
}
}

#beginTimestampPass(encoder, fnName, descriptor) {
Expand Down

0 comments on commit a027b92

Please sign in to comment.