Skip to content

Commit 2e3489a

Browse files
Update sample/timestampQuery/TimestampQueryManager.ts
Co-authored-by: Kai Ninomiya <[email protected]>
1 parent 686c801 commit 2e3489a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

sample/timestampQuery/TimestampQueryManager.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,22 @@ export default class TimestampQueryManager {
7575
}
7676

7777
// Once resolved, we can read back the value of timestamps
78-
readAsync(onTimestampReadBack: (timestamps: BigUint64Array) => void) {
79-
if (!this.timestampSupported) return new Promise(() => {});
80-
if (this.hasOngoingTimestampReadback) return new Promise(() => {});
78+
readAsync(onTimestampReadBack: (timestamps: BigUint64Array) => void): void {
79+
if (!this.timestampSupported) return;
80+
if (this.hasOngoingTimestampReadback) return;
8181

8282
this.hasOngoingTimestampReadback = true;
8383

8484
const buffer = this.timestampMapBuffer;
85-
return new Promise(resolve => {
86-
buffer.mapAsync(GPUMapMode.READ, 0, buffer.size)
85+
void buffer.mapAsync(GPUMapMode.READ)
8786
.then(() => {
88-
const rawData = buffer.getMappedRange(0, buffer.size);
87+
const rawData = buffer.getMappedRange();
8988
const timestamps = new BigUint64Array(rawData);
9089

9190
onTimestampReadBack(timestamps);
9291

9392
buffer.unmap();
9493
this.hasOngoingTimestampReadback = false;
95-
})
96-
});
94+
});
9795
}
9896
}

0 commit comments

Comments
 (0)