Cargo Features

wgpu = { version = "0.19.3", default-features = false, features = ["dx12", "metal", "angle", "vulkan-portability", "webgpu", "webgl", "spirv", "glsl", "wgsl", "naga-ir", "strict_asserts", "api_log_info", "trace", "replay", "fragile-send-sync-non-atomic-wasm"] }
default = dx12, metal, webgpu, wgsl

These default features are set whenever wgpu is added without default-features = false somewhere in the dependency tree.

dx12 default


⚠️ WIP: Not all backends can be manually configured today. On Windows & Linux the Vulkan & GLES backends are always enabled. See #3514 for more details.

Enables the DX12 backend on Windows.

Enables dx12 of optional wgpu-core

metal default

Enables the Metal backend on macOS & iOS.

Enables metal of optional wgpu-core


Enables the GLES backend via ANGLE on macOS using.

Enables gles of optional wgpu-core


Enables the Vulkan backend on macOS & iOS.

Enables vulkan of optional wgpu-core

webgpu default

Enables the WebGPU backend on Wasm. Disabled when targeting emscripten.

Enables wgsl-out of optional naga

webgl = hal

Enables the GLES backend on Wasm

* ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.

Enables gles of wgpu-core


### Shading language support

Enable accepting SPIR-V shaders as input.

Enables spv-in of naga

Affects util::make_spirv


Enable accepting GLSL shaders as input.

Enables glsl-in of naga

wgsl default

Enable accepting WGSL shaders as input.

Enables wgsl of optional wgpu-core

naga-ir = naga

Enable accepting naga IR shaders as input.


### Logging & Tracing
The following features do not have any effect on the WebGPU backend.

Apply run-time checks, even in release builds. These are in addition to the validation carried out at public APIs in all builds.

Enables strict_asserts of optional wgpu-core and wgpu-types


Log all API entry points at info instead of trace level.

Enables api_log_info of wgpu-core

trace = serde

Allow writing of trace capture files. See Adapter::request_device.

Enables trace of wgpu-core

replay = serde

Allow deserializing of trace capture files that were written with the trace feature. To replay a trace file use the wgpu player.

Enables replay of wgpu-core



Implement Send and Sync on Wasm, but only if atomics are not enabled.

WebGL/WebGPU objects can not be shared between threads. However, it can be useful to artificially mark them as Send and Sync anyways to make it easier to write cross-platform code. This is technically very unsafe in a multithreaded environment, but on a wasm binary compiled without atomics we know we are definitely not in a multithreaded environment.

Enables fragile-send-sync-non-atomic-wasm of wgpu-hal, wgpu-core, and wgpu-types

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features.

serde replay? trace?
hal win wasm32 not wasm32 unix not ios not mac not wasm32 emscripten fragile-send-sync-non-atomic-wasm? webgl?

Enables wgpu-hal

naga glsl? naga-ir? spirv?
wgc api_log_info? fragile-send-sync-non-atomic-wasm? replay? trace? webgl?

Enables wgpu-core