Skip to content

Commit

Permalink
[hal] Make Vulkan and GLES not depend on Metal-specific dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Sep 9, 2024
1 parent ffabb52 commit 9a5e646
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ metal = [
# Metal is only available on Apple platforms, therefore request MSL output also only if we target an Apple platform.
"naga/msl-out-if-target-apple",
"dep:block",
"dep:core-graphics-types",
"dep:metal",
"dep:objc",
"dep:raw-window-metal",
]
vulkan = [
Expand All @@ -52,9 +55,9 @@ vulkan = [
"dep:gpu-alloc",
"dep:gpu-descriptor",
"dep:libloading",
"dep:raw-window-metal",
"dep:smallvec",
"dep:android_system_properties",
"dep:raw-window-metal",
]
gles = [
"naga/glsl-out",
Expand All @@ -63,6 +66,7 @@ gles = [
"dep:khronos-egl",
"dep:libloading",
"dep:ndk-sys",
"dep:objc",
"windows/Win32_Graphics_OpenGL",
"windows/Win32_Graphics_Gdi",
"windows/Win32_System_LibraryLoader",
Expand Down Expand Up @@ -167,14 +171,15 @@ glutin_wgl_sys = { workspace = true, optional = true }
[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies]
# backend: Metal
block = { workspace = true, optional = true }
metal = { workspace = true, optional = true }
core-graphics-types = { workspace = true, optional = true }

# backend: Metal + GLES
objc = { workspace = true, optional = true }

# backend: Metal + Vulkan
raw-window-metal = { workspace = true, optional = true }

metal.workspace = true
objc.workspace = true
core-graphics-types.workspace = true

[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
wasm-bindgen.workspace = true
web-sys = { workspace = true, features = [
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/vulkan/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ impl super::Instance {
Ok(self.create_surface_from_vk_surface_khr(surface))
}

#[cfg(metal)]
#[cfg(target_vendor = "apple")]
fn create_surface_from_layer(
&self,
layer: raw_window_metal::Layer,
Expand Down

0 comments on commit 9a5e646

Please sign in to comment.