Avoid introducing spurious features for optional dependencies (#5691)

* Avoid introducing spurious features for optional dependencies

If a feature depends on an optional dependency without using the dep:
prefix, a feature with the same name as the optional dependency is
introduced. This feature almost certainly won't have any effect when
enabled other than increasing compile times and polutes the feature list
shown by cargo add. Consistently use dep: for all optional dependencies
to avoid this problem.

* Add changelog entry
This commit is contained in:
bjorn3 2024-05-12 08:45:35 +02:00 committed by GitHub
parent ebbf901304
commit fa48562229
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 28 deletions

View File

@ -70,6 +70,12 @@ By @stefnotch in [#5410](https://github.com/gfx-rs/wgpu/pull/5410)
#### Naga
### Changes
#### General
- Avoid introducing spurious features for optional dependencies. By @bjorn3 in [#5691](https://github.com/gfx-rs/wgpu/pull/5691)
### Bug Fixes
#### GLES / OpenGL

View File

@ -22,15 +22,15 @@ all-features = true
[features]
default = []
dot-out = []
glsl-in = ["pp-rs"]
glsl-in = ["dep:pp-rs"]
glsl-out = []
msl-out = []
serialize = ["serde", "bitflags/serde", "indexmap/serde"]
deserialize = ["serde", "bitflags/serde", "indexmap/serde"]
serialize = ["dep:serde", "bitflags/serde", "indexmap/serde"]
deserialize = ["dep:serde", "bitflags/serde", "indexmap/serde"]
arbitrary = ["dep:arbitrary", "bitflags/arbitrary", "indexmap/arbitrary"]
spv-in = ["petgraph", "spirv"]
spv-out = ["spirv"]
wgsl-in = ["hexf-parse", "unicode-xid", "compact"]
spv-in = ["dep:petgraph", "dep:spirv"]
spv-out = ["dep:spirv"]
wgsl-in = ["dep:hexf-parse", "dep:unicode-xid", "compact"]
wgsl-out = []
hlsl-out = []
compact = []

View File

@ -51,7 +51,7 @@ strict_asserts = ["wgt/strict_asserts"]
serde = ["dep:serde", "wgt/serde", "arrayvec/serde"]
## Enable API tracing.
trace = ["ron", "serde", "naga/serialize"]
trace = ["dep:ron", "serde", "naga/serialize"]
## Enable API replaying
replay = ["serde", "naga/deserialize"]

View File

@ -34,30 +34,30 @@ targets = [
[features]
default = ["link"]
metal = ["naga/msl-out", "block"]
metal = ["naga/msl-out", "dep:block"]
vulkan = [
"naga/spv-out",
"ash",
"gpu-alloc",
"gpu-descriptor",
"libloading",
"smallvec",
"android_system_properties",
"dep:ash",
"dep:gpu-alloc",
"dep:gpu-descriptor",
"dep:libloading",
"dep:smallvec",
"dep:android_system_properties",
]
gles = [
"naga/glsl-out",
"glow",
"glutin_wgl_sys",
"khronos-egl",
"libloading",
"ndk-sys",
"dep:glow",
"dep:glutin_wgl_sys",
"dep:khronos-egl",
"dep:libloading",
"dep:ndk-sys",
]
dx12 = [
"naga/hlsl-out",
"d3d12",
"bit-set",
"libloading",
"range-alloc",
"dep:d3d12",
"dep:bit-set",
"dep:libloading",
"dep:range-alloc",
"winapi/std",
"winapi/winbase",
"winapi/d3d12",
@ -66,9 +66,9 @@ dx12 = [
"winapi/dxgi1_6",
]
# TODO: This is a separate feature until Mozilla okays windows-rs, see https://github.com/gfx-rs/wgpu/issues/3207 for the tracking issue.
windows_rs = ["gpu-allocator"]
dxc_shader_compiler = ["hassle-rs"]
renderdoc = ["libloading", "renderdoc-sys"]
windows_rs = ["dep:gpu-allocator"]
dxc_shader_compiler = ["dep:hassle-rs"]
renderdoc = ["dep:libloading", "dep:renderdoc-sys"]
fragile-send-sync-non-atomic-wasm = ["wgt/fragile-send-sync-non-atomic-wasm"]
link = ["metal/link"]
# Panic when running into an out-of-memory error (for debugging purposes).

View File

@ -50,7 +50,7 @@ vulkan-portability = ["wgc?/vulkan"]
## Enables the GLES backend on Wasm
##
## * ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.
webgl = ["hal", "wgc/gles"]
webgl = ["dep:hal", "wgc/gles"]
#! **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
@ -69,7 +69,7 @@ glsl = ["naga/glsl-in", "wgc/glsl"]
wgsl = ["wgc?/wgsl"]
## Enable accepting naga IR shaders as input.
naga-ir = ["naga"]
naga-ir = ["dep:naga"]
#! ### Logging & Tracing
# --------------------------------------------------------------------