WebSharper.WebGPU

WebGPU bindings for F# — with WebSharper

Source

${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