Skip to content

Commit

Permalink
fix dx12 enabling wgpu-core on linux - add another workaround crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Jan 26, 2025
1 parent 39ac474 commit 31f1298
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ members = [
"wgpu",
"wgpu-core-conditional/arch-wasm32",
"wgpu-core-conditional/native-non-apple",
"wgpu-core-conditional/vendor-apple",
"wgpu-core-conditional/target-apple",
"wgpu-core-conditional/target-windows",
]
exclude = []
default-members = [
Expand All @@ -46,6 +47,8 @@ default-members = [
"wgpu-core-conditional/arch-wasm32",
"wgpu-core-conditional/native-non-apple",
"wgpu-core-conditional/vendor-apple",
"wgpu-core-conditional/target-apple",
"wgpu-core-conditional/target-windows",
]

[workspace.lints.clippy]
Expand Down Expand Up @@ -78,7 +81,8 @@ wgpu = { version = "24.0.0", path = "./wgpu", default-features = false, features
wgpu-core = { version = "24.0.0", path = "./wgpu-core" }
wgpu-core-if-arch-wasm32 = { version = "24.0.0", path = "./wgpu-core-conditional/arch-wasm32" }
wgpu-core-if-native-non-apple = { version = "24.0.0", path = "./wgpu-core-conditional/native-non-apple" }
wgpu-core-if-vendor-apple = { version = "24.0.0", path = "./wgpu-core-conditional/vendor-apple" }
wgpu-core-if-target-apple = { version = "24.0.0", path = "./wgpu-core-conditional/target-apple" }
wgpu-core-if-target-windows = { version = "24.0.0", path = "./wgpu-core-conditional/target-windows" }
wgpu-hal = { version = "24.0.0", path = "./wgpu-hal" }
wgpu-macros = { version = "24.0.0", path = "./wgpu-macros" }
wgpu-test = { version = "24.0.0", path = "./tests" }
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core-conditional/arch-wasm32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "wgpu-core-if-arch-wasm32"
version.workspace = true
authors.workspace = true
edition.workspace = true
description = "Workaround crate for enabling features in wgpu-core when targeting wasm32"
description = "Workaround crate for enabling in wgpu-core when targeting wasm32"
homepage.workspace = true
repository.workspace = true
keywords.workspace = true
Expand Down
4 changes: 1 addition & 3 deletions wgpu-core-conditional/native-non-apple/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "wgpu-core-if-native-non-apple"
version.workspace = true
authors.workspace = true
edition.workspace = true
description = "Workaround crate for enabling features in wgpu-core when targeting macOS/iOS"
description = "Workaround crate for enabling in wgpu-core when targeting native unix platforms excluding macOS/iOS/tvOS/VisionOS"
homepage.workspace = true
repository.workspace = true
keywords.workspace = true
Expand All @@ -16,7 +16,5 @@ gles = ["wgpu-core/gles"]
renderdoc = ["wgpu-core/renderdoc"]
vulkan = ["wgpu-core/vulkan"]

raw-window-handle = ["wgpu-core/raw-window-handle"]

[target.'cfg(any(windows, all(unix, not(target_arch = "wasm32"), not(target_vendor = "apple"))))'.dependencies]
wgpu-core.workspace = true
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "wgpu-core-if-vendor-apple"
name = "wgpu-core-if-target-apple"
version.workspace = true
authors.workspace = true
edition.workspace = true
description = "Workaround crate for enabling features in wgpu-core when targeting macOS/iOS"
description = "Workaround crate for enabling wgpu-core when targeting macOS/iOS/tvOS/VisionOS"
homepage.workspace = true
repository.workspace = true
keywords.workspace = true
Expand Down
18 changes: 18 additions & 0 deletions wgpu-core-conditional/target-windows/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "wgpu-core-if-target-windows"
version.workspace = true
authors.workspace = true
edition.workspace = true
description = "Workaround crate for enabling wgpu-core when targeting windows"
homepage.workspace = true
repository.workspace = true
keywords.workspace = true
license.workspace = true

[lib]

[features]
dx12 = ["wgpu-core/dx12"]

[target.'cfg(windows)'.dependencies]
wgpu-core.workspace = true
1 change: 1 addition & 0 deletions wgpu-core-conditional/target-windows/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//! No code. See README.md for details.
17 changes: 10 additions & 7 deletions wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,30 @@ default = ["wgsl", "dx12", "metal", "vulkan", "gles", "webgpu"]
# --------------------------------------------------------------------

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

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

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

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

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

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

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

wgpu-core-if-arch-wasm32 = { workspace = true, optional = true }
wgpu-core-if-native-non-apple = { workspace = true, optional = true }
wgpu-core-if-vendor-apple = { workspace = true, optional = true }
wgpu-core-if-target-apple = { workspace = true, optional = true }
wgpu-core-if-target-windows = { workspace = true, optional = true }


########################################
Expand Down

0 comments on commit 31f1298

Please sign in to comment.