An object containing the following properties:
A string providing a label that can be used to identify the object, for example in
GPUErrormessages or console warnings.
An array of objects defining where and when timestamp query values will be written for this pass. These objects have the following properties:
location: An enumerated value specifying when the timestamp will be executed. Available values are:
"beginning": The timestamp is executed along with the other encoded commands in the compute pass once the corresponding
"end": The timestamp is executed as part of a separate list of timestamp attachments once the pass ends.
queryIndex: A number specifying the index position in the
querySetthat the timestamp will be written to.
GPUQuerySetthat the timestamp will be written to.
GPUComputePassEncoder object instance.
timestamp-queryfeature is enabled in the
- No two
timestampWritesobjects have the same
location. In effect, this means that you can only run two timestamp queries per render pass.
- For each timestamp query, the
"timestamp", and the
queryIndexvalue is less than the
// ... // Create GPUCommandEncoder to encode commands to issue to the GPU const commandEncoder = device.createCommandEncoder(); // Initiate render pass const passEncoder = commandEncoder.beginComputePass(); // Issue commands passEncoder.setPipeline(computePipeline); passEncoder.setBindGroup(0, bindGroup); passEncoder.dispatchWorkgroups(Math.ceil(BUFFER_SIZE / 64)); // End the render pass passEncoder.end(); // Copy output buffer to staging buffer commandEncoder.copyBufferToBuffer( output, 0, // Source offset stagingBuffer, 0, // Destination offset BUFFER_SIZE, ); // End frame by passing array of command buffers to command queue for execution device.queue.submit([commandEncoder.finish()]); // ...
BCD tables only load in the browser
- The WebGPU API