This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const adapter = await navigator.gpu.requestAdapter(); | |
const device = await adapter.requestDevice(); | |
const trials = 100; | |
const buf = device.createBuffer({ usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, size: 4096 }); | |
let t1 = 0; | |
for (let i = 0; i < trials; ++i) { | |
const s = performance.now(); | |
const encoder = device.createCommandEncoder(); | |
encoder.clearBuffer(buf); |