Cargo Features

[dependencies]
wgpu-core = { version = "25.0.1", default-features = false, features = ["api_log_info", "resource_log_info", "strict_asserts", "observe_locks", "serde", "trace", "replay", "raw-window-handle", "wgsl", "glsl", "spirv", "counters", "fragile-send-sync-non-atomic-wasm", "std", "static-dxc", "portable-atomic", "dx12", "metal", "vulkan", "gles", "webgl", "angle", "vulkan-portability", "renderdoc", "noop"] }
default = std

See documentation for the wgpu crate for more in-depth information on these features.

TODO(https://github.com/gfx-rs/wgpu/issues/6826): "std" is a default feature for compatibility with prior behavior only, and should be removed once we know how wgpu-core’s dependents want to handle no_std.

api_log_info

Logging Configuration


Log all API entry points at info instead of trace level. Also, promotes certain debug log calls to info.

resource_log_info

Log resource lifecycle management at info instead of trace level.

strict_asserts

Runtime Checks


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 wgpu-types

observe_locks = std

Debugging


Enable lock order observation.

Enables ron ^0.9, serde_derive of serde

serde observe_locks? replay? trace?

Serialization


Enables serialization via serde on common wgpu types.

Enables serde, serde of wgpu-types, serde of arrayvec and hashbrown

trace = serde, std

Enable API tracing.

Enables bytemuck, ron ^0.9, serialize of naga, trace of wgpu-types

Affects trace::Trace, device::trace

replay = serde

Enable API replaying

Enables deserialize of naga

Affects device::trace

raw-window-handle

Surface Support


Enable creating surfaces using raw-window-handle

Enables raw-window-handle

wgsl

Shading Language Support


Enable ShaderModuleSource::Wgsl

Enables wgsl-in of naga

glsl

Enable ShaderModuleSource::Glsl

Enables glsl-in of naga

spirv

Enable ShaderModuleSource::SpirV

Enables bytemuck, spv-in of naga

counters

Other


Internally count resources and events for debugging purposes. If the counters feature is disabled, the counting infrastructure is removed from the build and the exposed counters always return 0.

Enables counters of wgpu-types

fragile-send-sync-non-atomic-wasm

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

Enables fragile-send-sync-non-atomic-wasm of wgpu-hal

std default observe_locks? trace?

Enable certain items to be Send and Sync when they would not otherwise be. Also enables backtraces in some error cases when also under cfg(debug_assertions).

static-dxc

External libraries


The following features facilitate integration with third-party supporting libraries.

Enable using the mach-dxcompiler-rs crate to compile DX12 shaders.

Enables static-dxc of wgpu-hal

portable-atomic

Enable portable atomics on platforms that do not support 64bit atomics.

Enables portable-atomic, portable-atomic of wgpu-hal

dx12

Target Conditional Features


Look to wgpu-hal's Cargo.toml for explaination how these features and the wgpu-core platform crates collude to provide platform-specific behavior.

DX12 backend

Enables dx12 of wgpu-core-deps-windows-linux-android

metal

Metal backend

Enables metal of wgpu-core-deps-apple

vulkan

Vulkan backend, only available on Windows, Linux, Android

Enables vulkan of wgpu-core-deps-windows-linux-android

gles

OpenGL backend, only available on Windows, Linux, Android, and Emscripten

Enables gles of wgpu-core-deps-emscripten and wgpu-core-deps-windows-linux-android

webgl

WebGL backend, only available on Emscripten

Enables webgl of wgpu-core-deps-wasm

angle

OpenGL backend, on macOS only

Enables angle of wgpu-core-deps-apple

vulkan-portability

Vulkan portability backend, only available on macOS

Enables vulkan-portability of wgpu-core-deps-apple

renderdoc

Renderdoc integration, only available on Windows, Linux, and Android

Enables renderdoc of wgpu-core-deps-windows-linux-android

noop

Enable the noop backend. TODO(https://github.com/gfx-rs/wgpu/issues/7120): there should be a hal feature

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.

wgpu-core-deps-emscripten emscripten gles?
wgpu-core-deps-wasm wasm32 not emscripten webgl?
wgpu-core-deps-apple apple angle? metal? vulkan-portability?
wgpu-core-deps-windows-linux-android win linux android dx12? gles? renderdoc? vulkan?