Cargo Features
[dependencies]
wgpu = { version = "0.19.4", 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
somewhere in the dependency tree.default-features = false - dx12 default
-
Backends
⚠️ 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.
- metal default
-
Enables the Metal backend on macOS & iOS.
- angle
-
Enables the GLES backend via ANGLE on macOS using.
- vulkan-portability
-
Enables the Vulkan backend on macOS & iOS.
- webgpu default
-
Enables the WebGPU backend on Wasm. Disabled when targeting
emscripten
. - webgl = hal
-
Enables the GLES backend on Wasm
* ⚠️ WIP: Currently will also enable GLES dependencies on any other targets. - spirv
-
### Shading language support
--------------------------------------------------------------------
Enable accepting SPIR-V shaders as input.Affects
util::make_spirv
… - glsl
-
Enable accepting GLSL shaders as input.
- wgsl default
-
Enable accepting WGSL shaders as input.
- naga-ir = naga
-
Enable accepting naga IR shaders as input.
- strict_asserts
-
### 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
- api_log_info
-
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
. - replay = serde
-
Allow deserializing of trace capture files that were written with the
trace
feature. To replay a trace file use the wgpu player. - fragile-send-sync-non-atomic-wasm
-
Other
Implement
Send
andSync
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
andSync
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. These features may have been created by mistake, and this functionality may be removed in the future.