Expand description
§Feature flags
§Backends
dx12(enabled by default) — Enables the DX12 backend on Windows.metal(enabled by default) — Enables the Metal backend on macOS & iOS.vulkan(enabled by default) — Enables the Vulkan backend on Windows, Linux, and Android.gles(enabled by default) — Enables the OpenGL/GLES backend on Windows, Linux, Android, and Emscripten.webgpu(enabled by default) — Enables the WebGPU backend on WebAssembly.
§Conditional Backends
angle— Enables the GLES backend on macOS only for use with ANGLE.vulkan-portability— Enables the Vulkan backend on macOS & iOS only for use with MoltenVK.webgl— Enables the GLES backend on WebAssembly only.
§Backend features
-
drm— Support creating textures from DRM display/window handles. -
noop— Enables the noop backend for testing.This backend allows creating resources such as buffers and textures, but performs no computation. Because it lacks basic functionality, it is only actually used if explicitly enabled through
NoopBackendOptions.
Note: In the documentation, if you see that an item depends on a backend, it means that the item is only available when that backend is enabled and the backend is supported on the current platform.
§Shading language support
These features enable support for that input language on all platforms. We will translate the input language to whatever the backend requires.
spirv— Enable accepting SPIR-V shaders as input.glsl— Enable accepting GLSL shaders as input.wgsl(enabled by default) — Enable accepting WGSL shaders as input.naga-ir— Enable accepting naga IR shaders as input.
§Assertions and Serialization
strict_asserts— Apply run-time checks, even in release builds. These are in addition to the validation carried out at public APIs in all builds.serde— Enables serialization viaserdeon common wgpu types.trace— Allow writing of trace capture files. SeeAdapter::request_device.
§External libraries
The following features facilitate integration with third-party supporting libraries.
-
static-dxc— Enables statically linking DXC.Normally, to use the modern DXC shader compiler with wgpu, the final application must be shipped alongside
dxcompiler.dll(min v1.8.2502) (which can be downloaded from Microsoft’s GitHub). This feature statically links a version of DXC so that no external binaries are required to compile DX12 shaders.
§Other
-
counters— 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. -
fragile-send-sync-non-atomic-wasm— ImplementSendandSyncon 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
SendandSyncanyways 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 is a definitionally single-threaded environment. -
web(enabled by default) — Use web-specific libraries on WASMThose libraries (wasm-bindgen, web-sys, js-sys) can only be used when there is a JavaScript context around the WASM VM, e.g., when the WASM binary is used in a browser.
-
std(enabled by default) — Enables use of the standard library withinwgpuand its dependencies.This can allow for better error reporting and for improved multithreading support.
-
exhaust— Enablesexhaustmethod forTextureFormatofwgpu-types.This is relevant for
wgpu-info.
§Feature Aliases
These features aren’t actually features on the crate itself, but a convenient shorthand for complicated cases.
wgpu_core— Enabled when there is any non-webgpu backend enabled on the platform.naga— Enabled when targetglslorspirvinput is enabled, or whenwgpu_coreis enabled.