Cargo Features
wgpu-core-deps-apple has no features set by default.
[dependencies]
wgpu-core-deps-apple = { version = "25.0.0", features = ["metal", "angle", "vulkan-portability"] }
- metal
-
wgpu-hal:
Backend Features
The interaction of features between wgpu-core and wgpu-hal is a bit nuanced to get the desired behavior on all platforms.
At the wgpu-hal level the features are defined to enable the backends on all platforms that can compile the backend. Vulkan for example will have an effect on Windows, Mac, Linux, and Android. This is done with target conditional dependencies in wgpu-hal. This allows
--all-features
to compile on all platforms.wgpu-core's features are defined to enable the backends on their "default" platforms. For example we exclude the Vulkan backend on MacOS unless a separate feature
vulkan-portability
is enabled. In response to these features, it enables features of platform specific crates. For example, thevulkan
feature in wgpu-core enables thevulkan
feature inwgpu-core-deps-windows-linux-android
which in turn enables thevulkan
feature inwgpu-hal
only on those platforms. If you enable thevulkan-portability
feature, it will enable thevulkan
feature inwgpu-core-deps-apple
. The only way to do this is unfortunately to have a separate crate for each platform category that participates in the feature unification.This trick doesn't work at the
wgpu
level, because thewgpu
->wgpu-core
dependency is conditional, making the Cargo.toml signifigantly more complicated in all areas.See https://github.com/gfx-rs/wgpu/issues/3514, https://github.com/gfx-rs/wgpu/pull/7076, and https://github.com/rust-lang/cargo/issues/1197 for more information.
Enables the Metal backend when targeting Apple platforms.
- angle
- vulkan-portability
wgpu-core-deps-apple has 3 features without comments.