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

Enables metal of wgpu-hal

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, the vulkan feature in wgpu-core enables the vulkan feature in wgpu-core-deps-windows-linux-android which in turn enables the vulkan feature in wgpu-hal only on those platforms. If you enable the vulkan-portability feature, it will enable the vulkan feature in wgpu-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 the wgpu -> 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

Enables gles and renderdoc of wgpu-hal

vulkan-portability

Enables renderdoc and vulkan of wgpu-hal

wgpu-core-deps-apple has 3 features without comments.