Cloudflare Docs
Durable Objects
Edit this page on GitHub
Set theme to dark (⇧+D)

WebGPU

The WebGPU API, allows you to use the GPU directly from JavaScript.

The WebGPU API is only accessible from within Durable Objects. The WebGPU API cannot be used from within Workers.

To use the WebGPU API in local development, enable the experimental and webgpu compatibility flags in the wrangler.toml configuration file of your Durable Object.

compatibility_flags = ["experimental", "webgpu"]

The following subset of the WebGPU API is available from within Durable Objects:

APISupported?Notes
navigator.gpu
GPU.requestAdapter
GPUAdapterInfo
GPUAdapter
GPUBindGroupLayout
GPUBindGroup
GPUBuffer
GPUCommandBuffer
GPUCommandEncoder
GPUComputePassEncoder
GPUComputePipeline
GPUComputePipelineError
GPUDevice
GPUOutOfMemoryError
GPUValidationError
GPUInternalError
GPUDeviceLostInfo
GPUPipelineLayout
GPUQuerySet
GPUQueue
GPUSampler
GPUCompilationMessage
GPUShaderModule
GPUSupportedFeatures
GPUSupportedLimits
GPUMapMode
GPUShaderStage
GPUUncapturedErrorEvent

The following subset of the WebGPU API is not yet supported:

APISupported?Notes
GPU.getPreferredCanvasFormat
GPURenderBundle
GPURenderBundleEncoder
GPURenderPassEncoder
GPURenderPipeline
GPUShaderModule
GPUTexture
GPUTextureView
GPUExternalTexture

​​ Examples