Skip to content

Commit d24dbc9

Browse files
committed
fix dx12 enabling wgpu-core on linux - add another workaround crate
1 parent 39ac474 commit d24dbc9

File tree

9 files changed

+41
-18
lines changed

9 files changed

+41
-18
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ members = [
2323
"wgpu",
2424
"wgpu-core-conditional/arch-wasm32",
2525
"wgpu-core-conditional/native-non-apple",
26-
"wgpu-core-conditional/vendor-apple",
26+
"wgpu-core-conditional/target-apple",
27+
"wgpu-core-conditional/target-windows",
2728
]
2829
exclude = []
2930
default-members = [
@@ -45,7 +46,8 @@ default-members = [
4546
"wgpu",
4647
"wgpu-core-conditional/arch-wasm32",
4748
"wgpu-core-conditional/native-non-apple",
48-
"wgpu-core-conditional/vendor-apple",
49+
"wgpu-core-conditional/target-apple",
50+
"wgpu-core-conditional/target-windows",
4951
]
5052

5153
[workspace.lints.clippy]
@@ -78,7 +80,8 @@ wgpu = { version = "24.0.0", path = "./wgpu", default-features = false, features
7880
wgpu-core = { version = "24.0.0", path = "./wgpu-core" }
7981
wgpu-core-if-arch-wasm32 = { version = "24.0.0", path = "./wgpu-core-conditional/arch-wasm32" }
8082
wgpu-core-if-native-non-apple = { version = "24.0.0", path = "./wgpu-core-conditional/native-non-apple" }
81-
wgpu-core-if-vendor-apple = { version = "24.0.0", path = "./wgpu-core-conditional/vendor-apple" }
83+
wgpu-core-if-target-apple = { version = "24.0.0", path = "./wgpu-core-conditional/target-apple" }
84+
wgpu-core-if-target-windows = { version = "24.0.0", path = "./wgpu-core-conditional/target-windows" }
8285
wgpu-hal = { version = "24.0.0", path = "./wgpu-hal" }
8386
wgpu-macros = { version = "24.0.0", path = "./wgpu-macros" }
8487
wgpu-test = { version = "24.0.0", path = "./tests" }

wgpu-core-conditional/arch-wasm32/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "wgpu-core-if-arch-wasm32"
33
version.workspace = true
44
authors.workspace = true
55
edition.workspace = true
6-
description = "Workaround crate for enabling features in wgpu-core when targeting wasm32"
6+
description = "Workaround crate for enabling in wgpu-core when targeting wasm32"
77
homepage.workspace = true
88
repository.workspace = true
99
keywords.workspace = true

wgpu-core-conditional/native-non-apple/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "wgpu-core-if-native-non-apple"
33
version.workspace = true
44
authors.workspace = true
55
edition.workspace = true
6-
description = "Workaround crate for enabling features in wgpu-core when targeting macOS/iOS"
6+
description = "Workaround crate for enabling in wgpu-core when targeting native unix platforms excluding macOS/iOS/tvOS/VisionOS"
77
homepage.workspace = true
88
repository.workspace = true
99
keywords.workspace = true
@@ -16,7 +16,5 @@ gles = ["wgpu-core/gles"]
1616
renderdoc = ["wgpu-core/renderdoc"]
1717
vulkan = ["wgpu-core/vulkan"]
1818

19-
raw-window-handle = ["wgpu-core/raw-window-handle"]
20-
2119
[target.'cfg(any(windows, all(unix, not(target_arch = "wasm32"), not(target_vendor = "apple"))))'.dependencies]
2220
wgpu-core.workspace = true

wgpu-core-conditional/vendor-apple/Cargo.toml renamed to wgpu-core-conditional/target-apple/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
2-
name = "wgpu-core-if-vendor-apple"
2+
name = "wgpu-core-if-target-apple"
33
version.workspace = true
44
authors.workspace = true
55
edition.workspace = true
6-
description = "Workaround crate for enabling features in wgpu-core when targeting macOS/iOS"
6+
description = "Workaround crate for enabling wgpu-core when targeting macOS/iOS/tvOS/VisionOS"
77
homepage.workspace = true
88
repository.workspace = true
99
keywords.workspace = true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "wgpu-core-if-target-windows"
3+
version.workspace = true
4+
authors.workspace = true
5+
edition.workspace = true
6+
description = "Workaround crate for enabling wgpu-core when targeting windows"
7+
homepage.workspace = true
8+
repository.workspace = true
9+
keywords.workspace = true
10+
license.workspace = true
11+
12+
[lib]
13+
14+
[features]
15+
dx12 = ["wgpu-core/dx12"]
16+
17+
[target.'cfg(windows)'.dependencies]
18+
wgpu-core.workspace = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//! No code. See README.md for details.

wgpu/Cargo.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,30 @@ default = ["wgsl", "dx12", "metal", "vulkan", "gles", "webgpu"]
3434
# --------------------------------------------------------------------
3535

3636
## Enables the DX12 backend on Windows.
37-
# Dx12 doesn't do anything on non-windows wgpu-core & wgpu-hal, so we don't need a proxy crate here.
38-
dx12 = ["wgpu-core/dx12"]
37+
# Note that while wgpu-hal ignores dx12 for non-windows targets, we still need to use a proxy crate,
38+
# since for non-windows targets we don't want to include wgpu-core in the first place via this feature.
39+
dx12 = ["wgpu-core-if-target-windows/dx12"]
3940

4041
## Enables the Metal backend on macOS & iOS.
41-
# Metal doesn't do anything on non-Apple wgpu-core & wgpu-hal, but we already have a proxy crate for Apple platforms anyways.
42-
metal = ["wgpu-core-if-vendor-apple/metal"]
42+
# Note that while wgpu-hal ignores metal for non-apple targets, we still need to use a proxy crate,
43+
# since for non-apple targets we don't want to include wgpu-core in the first place via this feature.
44+
metal = ["wgpu-core-if-target-apple/metal"]
4345

4446
## Enables the Vulkan backend on Windows, Linux, and Android.
4547
##
4648
## For enabling Vulkan on macOS & iOS, use the `vulkan-portability` feature.
4749
vulkan = ["wgpu-core-if-native-non-apple/vulkan"]
4850

4951
## Enables the Vulkan backend on macOS & iOS.
50-
vulkan-portability = ["wgpu-core-if-vendor-apple/vulkan"]
52+
vulkan-portability = ["wgpu-core-if-target-apple/vulkan"]
5153

5254
## Enables the OpenGL/GLES backend on Windows, Linux, and Android.
5355
##
5456
## For enabling WebGL use the `webgl` feature, for enabling OpenGL via ANGLE on macOS use the `angle` feature.
5557
gles = ["wgpu-core-if-native-non-apple/gles"]
5658

5759
## Enables the GLES backend via [ANGLE](https://github.com/google/angle) on macOS using.
58-
angle = ["wgpu-core-if-vendor-apple/gles"]
60+
angle = ["wgpu-core-if-target-apple/gles"]
5961

6062
## Enables GLES backend (WebGL) on Wasm
6163
webgl = ["wgpu-core-if-arch-wasm32/gles"]
@@ -160,7 +162,8 @@ static_assertions.workspace = true
160162

161163
wgpu-core-if-arch-wasm32 = { workspace = true, optional = true }
162164
wgpu-core-if-native-non-apple = { workspace = true, optional = true }
163-
wgpu-core-if-vendor-apple = { workspace = true, optional = true }
165+
wgpu-core-if-target-apple = { workspace = true, optional = true }
166+
wgpu-core-if-target-windows = { workspace = true, optional = true }
164167

165168

166169
########################################

0 commit comments

Comments
 (0)