${status}
Adapter & device
navigator.gpu.requestAdapter() → GPUAdapter, then
requestDevice() → GPUDevice. Adapter info,
features, limits and getPreferredCanvasFormat()
are read below.
- Adapter
- ${adapterInfo}
- Preferred format
- ${format}
- Features
- ${features}
- Limits
- ${limits}
Render pass
A rotating triangle: a GPUShaderModule (WGSL), a
GPURenderPipeline, a GPUBindGroup with a uniform buffer,
and a GPURenderPassEncoder that clears and draws each frame.
${renderState}
Compute pass
A WGSL compute shader doubles an array of floats in a storage buffer; the result is
copied to a mappable buffer and read back with mapAsync /
getMappedRange.
${computeResult}
What this sample exercises
navigator.gpu:requestAdapter,getPreferredCanvasFormat,wgslLanguageFeatures.GPUAdapter:info,features,limits,isFallbackAdapter,requestDevice.GPUDevice: buffer/texture/pipeline/bind-group creation and the defaultqueue.- Graphics: shader modules, render pipelines, bind groups, uniform buffers, render passes,
draw. - Compute: storage buffers, compute pipelines,
dispatchWorkgroups,copyBufferToBuffer,mapAsync/getMappedRange.