Add VisionOS Support (#6888)

* Add visionos support

* Use `target_vendor = "apple"`

* Fixes

* Build VisionOS

* Gah

* Bleh

* Typos

---------

Co-authored-by: Guus Waals <_@guusw.nl>
This commit is contained in:
Connor Fitzgerald 2025-01-10 12:33:58 -05:00 committed by GitHub
parent 1aabf22e7a
commit b0f1fa66ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 78 additions and 46 deletions

View File

@ -34,7 +34,7 @@ env:
# We sometimes need nightly to use special things in CI. # We sometimes need nightly to use special things in CI.
# #
# In order to prevent CI regressions, we pin the nightly version. # In order to prevent CI regressions, we pin the nightly version.
NIGHTLY_VERSION: "nightly-2024-10-10" NIGHTLY_VERSION: "nightly-2024-10-17"
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure. # This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
REPO_MSRV: "1.83" REPO_MSRV: "1.83"
# This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates, # This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates,
@ -111,6 +111,14 @@ jobs:
target: aarch64-apple-ios target: aarch64-apple-ios
kind: native kind: native
# VisionOS
- name: VisionOS aarch64
os: macos-14
target: aarch64-apple-visionos
kind: wgpu-only
toolchain: nightly
extra-flags: -Zbuild-std
# Linux # Linux
- name: Linux x86_64 - name: Linux x86_64
os: ubuntu-22.04 os: ubuntu-22.04
@ -137,7 +145,7 @@ jobs:
- name: Emscripten - name: Emscripten
os: ubuntu-22.04 os: ubuntu-22.04
target: wasm32-unknown-emscripten target: wasm32-unknown-emscripten
kind: em kind: wgpu-only
name: Clippy ${{ matrix.name }} name: Clippy ${{ matrix.name }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -146,12 +154,31 @@ jobs:
- name: checkout repo - name: checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Repo MSRV toolchain - name: Install Toolchain (Repo MSRV)
if: matrix.toolchain != 'nightly'
run: | run: |
rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal --component clippy --target ${{ matrix.target }} rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal --component clippy
rustup target add ${{ matrix.target }} --toolchain ${{ env.REPO_MSRV }}
rustup override set ${{ env.REPO_MSRV }} rustup override set ${{ env.REPO_MSRV }}
cargo -V cargo -V
# In order to build on platforms that require a nightly toolchain, we install stable as expected,
# add the rust-src component, then tell stable to consider itself nightly by setting RUSTC_BOOTSTRAP=1.
#
# This is not formally "correct" thing to do, but it saves significant maintainer burden. If we were to
# use a proper nightly toolchain we would have to manually find a date that works. Even with a date that is
# carefully coordinated with the version of stable we are using, there are often mismatches of clippy lints
# between nightly and stable. This is a real mess. By using RUSTC_BOOTSTRAP=1, we get access to all the nice
# nightly features without needing to go through the hassle of maintaining a nightly toolchain.
#
# RUSTC_BOOTSTRAP=1 is how the rust project builds itself when bootstrapping the compiler, so while not "stable"
# it has been around for many years and don't anticipate it going away any time soon.
- name: Install Toolchain (Repo MSRV - Pseudo Nightly)
if: matrix.toolchain == 'nightly'
run: |
rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal --component clippy,rust-src
echo "RUSTC_BOOTSTRAP=1" >> "$GITHUB_ENV"
- name: disable debug - name: disable debug
shell: bash shell: bash
run: | run: |
@ -183,6 +210,7 @@ jobs:
# the android sdk doesn't use the conventional name for ar, so explicitly set it. # the android sdk doesn't use the conventional name for ar, so explicitly set it.
echo "AR_aarch64_linux_android=llvm-ar" >> "$GITHUB_ENV" echo "AR_aarch64_linux_android=llvm-ar" >> "$GITHUB_ENV"
# Building for wasm32 requires a series of specific tests for the WebGPU backend.
- name: check web - name: check web
if: matrix.kind == 'web' if: matrix.kind == 'web'
shell: bash shell: bash
@ -190,29 +218,31 @@ jobs:
set -e set -e
# build for WebGPU # build for WebGPU
cargo clippy --target ${{ matrix.target }} --tests --features glsl,spirv,fragile-send-sync-non-atomic-wasm cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --features glsl,spirv,fragile-send-sync-non-atomic-wasm
cargo clippy --target ${{ matrix.target }} --tests --features glsl,spirv cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --features glsl,spirv
cargo doc --target ${{ matrix.target }} --no-deps --features glsl,spirv cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} --no-deps --features glsl,spirv
# all features # all features
cargo clippy --target ${{ matrix.target }} --tests --all-features cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --all-features
cargo doc --target ${{ matrix.target }} --no-deps --all-features cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} --no-deps --all-features
- name: check em # Building for platforms where the tests do not compile.
if: matrix.kind == 'em' - name: check wgpu only
if: matrix.kind == 'wgpu-only'
shell: bash shell: bash
run: | run: |
set -e set -e
# build for Emscripten # check with no features
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu -p wgpu-hal --no-default-features
# Don't check samples since we use winit in our samples which has dropped support for Emscripten. # Don't check samples since we use winit in our samples which has dropped support for Emscripten.
# all features # Check with all features.
cargo clippy --target ${{ matrix.target }} -p wgpu-hal --all-features cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu-hal --all-features
cargo clippy --target ${{ matrix.target }} -p wgpu --all-features cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu --all-features
# Building for native platforms with standard tests.
- name: check native - name: check native
if: matrix.kind == 'native' if: matrix.kind == 'native'
shell: bash shell: bash
@ -220,13 +250,13 @@ jobs:
set -e set -e
# check with no features # check with no features
cargo clippy --target ${{ matrix.target }} --no-default-features cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --no-default-features
# Check with all features. # Check with all features.
cargo clippy --target ${{ matrix.target }} --tests --benches --all-features cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --benches --all-features
# build docs # build docs
cargo doc --target ${{ matrix.target }} --all-features --no-deps cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} --all-features --no-deps
- name: check private item docs - name: check private item docs
if: matrix.kind == 'native' if: matrix.kind == 'native'
@ -235,7 +265,7 @@ jobs:
set -e set -e
# wgpu_core package # wgpu_core package
cargo doc --target ${{ matrix.target }} \ cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} \
--package wgpu-core \ --package wgpu-core \
--package wgpu-hal \ --package wgpu-hal \
--package naga \ --package naga \

View File

@ -162,6 +162,7 @@ By @wumpf in [#6849](https://github.com/gfx-rs/wgpu/pull/6849).
- Move raytracing alignments into HAL instead of in core. By @Vecvec in [#6563](https://github.com/gfx-rs/wgpu/pull/6563). - Move raytracing alignments into HAL instead of in core. By @Vecvec in [#6563](https://github.com/gfx-rs/wgpu/pull/6563).
- Allow for statically linking DXC rather than including separate `.dll` files. By @DouglasDwyer in [#6574](https://github.com/gfx-rs/wgpu/pull/6574). - Allow for statically linking DXC rather than including separate `.dll` files. By @DouglasDwyer in [#6574](https://github.com/gfx-rs/wgpu/pull/6574).
- `DeviceType` and `AdapterInfo` now impl `Hash` by @cwfitzgerald in [#6868](https://github.com/gfx-rs/wgpu/pull/6868) - `DeviceType` and `AdapterInfo` now impl `Hash` by @cwfitzgerald in [#6868](https://github.com/gfx-rs/wgpu/pull/6868)
- Add build support for Apple Vision Pro. By @guusw in [#6611](https://github.com/gfx-rs/wgpu/pull/6611).
- Add `wgsl_language_features` for obtaining available WGSL language feature by @sagudev in [#6814](https://github.com/gfx-rs/wgpu/pull/6814) - Add `wgsl_language_features` for obtaining available WGSL language feature by @sagudev in [#6814](https://github.com/gfx-rs/wgpu/pull/6814)
##### Vulkan ##### Vulkan
@ -171,6 +172,7 @@ By @wumpf in [#6849](https://github.com/gfx-rs/wgpu/pull/6849).
##### Metal ##### Metal
- Allow using some 32-bit floating-point atomic operations (load, store, add, sub, exchange) in shaders. It requires Metal 3.0+ with Apple 7, 8, 9 or Mac 2. By @AsherJingkongChen in [#6234](https://github.com/gfx-rs/wgpu/pull/6234). - Allow using some 32-bit floating-point atomic operations (load, store, add, sub, exchange) in shaders. It requires Metal 3.0+ with Apple 7, 8, 9 or Mac 2. By @AsherJingkongChen in [#6234](https://github.com/gfx-rs/wgpu/pull/6234).
- Add build support for Apple Vision Pro. By @guusw in [#6611](https://github.com/gfx-rs/wgpu/pull/6611).
#### Changes #### Changes

View File

@ -36,7 +36,7 @@ features = [
] ]
# We want the wgpu-core Metal backend on macOS and iOS. # We want the wgpu-core Metal backend on macOS and iOS.
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgpu-core] [target.'cfg(target_vendor = "apple")'.dependencies.wgpu-core]
workspace = true workspace = true
features = ["metal"] features = ["metal"]

View File

@ -3,7 +3,7 @@ fn main() {
dot_out: { feature = "dot-out" }, dot_out: { feature = "dot-out" },
glsl_out: { feature = "glsl-out" }, glsl_out: { feature = "glsl-out" },
hlsl_out: { any(feature = "hlsl-out", all(target_os = "windows", feature = "hlsl-out-if-target-windows")) }, hlsl_out: { any(feature = "hlsl-out", all(target_os = "windows", feature = "hlsl-out-if-target-windows")) },
msl_out: { any(feature = "msl-out", all(any(target_os = "ios", target_os = "macos"), feature = "msl-out-if-target-apple")) }, msl_out: { any(feature = "msl-out", all(target_vendor = "apple", feature = "msl-out-if-target-apple")) },
spv_out: { feature = "spv-out" }, spv_out: { feature = "spv-out" },
wgsl_out: { feature = "wgsl-out" }, wgsl_out: { feature = "wgsl-out" },
} }

View File

@ -15,7 +15,7 @@ arbitrary = { version = "1.4.1", features = ["derive"] }
# See https://github.com/rust-fuzz/libfuzzer/issues/126 # See https://github.com/rust-fuzz/libfuzzer/issues/126
libfuzzer-sys = ">0.4.0,<=0.4.7" libfuzzer-sys = ">0.4.0,<=0.4.7"
[target.'cfg(not(any(target_arch = "wasm32", target_os = "ios")))'.dependencies.naga] [target.'cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "visionos")))'.dependencies.naga]
path = ".." path = ".."
version = "23.0.0" version = "23.0.0"
features = ["arbitrary", "spv-in", "wgsl-in", "glsl-in"] features = ["arbitrary", "spv-in", "wgsl-in", "glsl-in"]

View File

@ -150,7 +150,7 @@ fn collect_validation_jobs(jobs: &mut Vec<Job>, cmd: ValidateSubcommand) -> anyh
| ValidateSubcommand::Spirv | ValidateSubcommand::Spirv
| ValidateSubcommand::Glsl | ValidateSubcommand::Glsl
| ValidateSubcommand::Dot => true, | ValidateSubcommand::Dot => true,
ValidateSubcommand::Metal => cfg!(any(target_os = "macos", target_os = "ios")), ValidateSubcommand::Metal => cfg!(target_vendor = "apple"),
// The FXC compiler is only available on Windows. // The FXC compiler is only available on Windows.
// //
// The DXC compiler can be built and run on any platform, // The DXC compiler can be built and run on any platform,

View File

@ -7,7 +7,7 @@ fn main() {
webgl: { all(target_arch = "wasm32", not(target_os = "emscripten"), gles) }, webgl: { all(target_arch = "wasm32", not(target_os = "emscripten"), gles) },
dx12: { all(target_os = "windows", feature = "dx12") }, dx12: { all(target_os = "windows", feature = "dx12") },
gles: { all(feature = "gles") }, gles: { all(feature = "gles") },
metal: { all(any(target_os = "ios", target_os = "macos"), feature = "metal") }, metal: { all(target_vendor = "apple", feature = "metal") },
vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") } vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") }
} }
} }

View File

@ -10,7 +10,7 @@
#![cfg_attr( #![cfg_attr(
all( all(
not(all(feature = "vulkan", not(target_arch = "wasm32"))), not(all(feature = "vulkan", not(target_arch = "wasm32"))),
not(all(feature = "metal", any(target_os = "macos", target_os = "ios"))), not(all(feature = "metal", any(target_vendor = "apple"))),
not(all(feature = "dx12", windows)), not(all(feature = "dx12", windows)),
not(feature = "gles"), not(feature = "gles"),
), ),

View File

@ -177,7 +177,7 @@ glutin_wgl_sys = { workspace = true, optional = true }
[target.'cfg(all(windows, not(target_arch = "aarch64")))'.dependencies] [target.'cfg(all(windows, not(target_arch = "aarch64")))'.dependencies]
mach-dxcompiler-rs = { workspace = true, optional = true } mach-dxcompiler-rs = { workspace = true, optional = true }
[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies] [target.'cfg(target_vendor = "apple")'.dependencies]
# backend: Metal # backend: Metal
block = { workspace = true, optional = true } block = { workspace = true, optional = true }
@ -221,7 +221,7 @@ env_logger.workspace = true
glam.workspace = true # for ray-traced-triangle example glam.workspace = true # for ray-traced-triangle example
winit.workspace = true # for "halmark" example winit.workspace = true # for "halmark" example
[target.'cfg(not(any(target_arch = "wasm32", target_os = "ios")))'.dev-dependencies] [target.'cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "visionos")))'.dev-dependencies]
glutin-winit = { workspace = true, features = [ glutin-winit = { workspace = true, features = [
"egl", "egl",
"wgl", "wgl",

View File

@ -9,7 +9,7 @@ fn main() {
Emscripten: { all(target_os = "emscripten", gles) }, Emscripten: { all(target_os = "emscripten", gles) },
dx12: { all(target_os = "windows", feature = "dx12") }, dx12: { all(target_os = "windows", feature = "dx12") },
gles: { all(feature = "gles") }, gles: { all(feature = "gles") },
metal: { all(any(target_os = "ios", target_os = "macos"), feature = "metal") }, metal: { all(target_vendor = "apple", feature = "metal") },
vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") }, vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") },
// ⚠️ Keep in sync with target.cfg() definition in Cargo.toml and cfg_alias in `wgpu` crate ⚠️ // ⚠️ Keep in sync with target.cfg() definition in Cargo.toml and cfg_alias in `wgpu` crate ⚠️
static_dxc: { all(target_os = "windows", feature = "static-dxc", not(target_arch = "aarch64")) } static_dxc: { all(target_os = "windows", feature = "static-dxc", not(target_arch = "aarch64")) }

View File

@ -797,7 +797,7 @@ impl<A: hal::Api> Example<A> {
cfg_if::cfg_if! { cfg_if::cfg_if! {
// Apple + Metal // Apple + Metal
if #[cfg(all(any(target_os = "macos", target_os = "ios"), feature = "metal"))] { if #[cfg(all(target_vendor = "apple", feature = "metal"))] {
type Api = hal::api::Metal; type Api = hal::api::Metal;
} }
// Wasm + Vulkan // Wasm + Vulkan

View File

@ -10,7 +10,7 @@
extern crate wgpu_hal as hal; extern crate wgpu_hal as hal;
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))] #[cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "visionos")))]
fn main() { fn main() {
use std::{ffi::CString, num::NonZeroU32}; use std::{ffi::CString, num::NonZeroU32};
@ -256,7 +256,8 @@ fn main() {
#[cfg(any( #[cfg(any(
all(target_arch = "wasm32", not(target_os = "emscripten")), all(target_arch = "wasm32", not(target_os = "emscripten")),
target_os = "ios" target_os = "ios",
target_os = "visionos"
))] ))]
fn main() { fn main() {
eprintln!("This example is not supported on Windows and non-emscripten wasm32") eprintln!("This example is not supported on Windows and non-emscripten wasm32")
@ -264,7 +265,8 @@ fn main() {
#[cfg(not(any( #[cfg(not(any(
all(target_arch = "wasm32", not(target_os = "emscripten")), all(target_arch = "wasm32", not(target_os = "emscripten")),
target_os = "ios" target_os = "ios",
target_os = "visionos"
)))] )))]
fn fill_screen(exposed: &hal::ExposedAdapter<hal::api::Gles>, width: u32, height: u32) { fn fill_screen(exposed: &hal::ExposedAdapter<hal::api::Gles>, width: u32, height: u32) {
use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _}; use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _};

View File

@ -1107,7 +1107,7 @@ impl<A: hal::Api> Example<A> {
cfg_if::cfg_if! { cfg_if::cfg_if! {
// Apple + Metal // Apple + Metal
if #[cfg(all(any(target_os = "macos", target_os = "ios"), feature = "metal"))] { if #[cfg(all(target_vendor = "apple", feature = "metal"))] {
type Api = hal::api::Metal; type Api = hal::api::Metal;
} }
// Wasm + Vulkan // Wasm + Vulkan

View File

@ -785,7 +785,7 @@ impl crate::Instance for Instance {
"libEGL.dll", "libEGL.dll",
) )
} }
} else if cfg!(any(target_os = "macos", target_os = "ios")) { } else if cfg!(target_vendor = "apple") {
unsafe { unsafe {
khronos_egl::DynamicInstance::<khronos_egl::EGL1_4>::load_required_from_filename( khronos_egl::DynamicInstance::<khronos_egl::EGL1_4>::load_required_from_filename(
"libEGL.dylib", "libEGL.dylib",

View File

@ -121,7 +121,7 @@ impl crate::Instance for Instance {
window_handle: raw_window_handle::RawWindowHandle, window_handle: raw_window_handle::RawWindowHandle,
) -> Result<Surface, crate::InstanceError> { ) -> Result<Surface, crate::InstanceError> {
match window_handle { match window_handle {
#[cfg(target_os = "ios")] #[cfg(any(target_os = "ios", target_os = "visionos"))]
raw_window_handle::RawWindowHandle::UiKit(handle) => { raw_window_handle::RawWindowHandle::UiKit(handle) => {
Ok(unsafe { Surface::from_view(handle.ui_view.cast()) }) Ok(unsafe { Surface::from_view(handle.ui_view.cast()) })
} }

View File

@ -1003,7 +1003,7 @@ impl PhysicalDeviceProperties {
} }
// Require `VK_KHR_portability_subset` on macOS/iOS // Require `VK_KHR_portability_subset` on macOS/iOS
#[cfg(any(target_os = "macos", target_os = "ios"))] #[cfg(target_vendor = "apple")]
extensions.push(khr::portability_subset::NAME); extensions.push(khr::portability_subset::NAME);
// Require `VK_EXT_texture_compression_astc_hdr` if the associated feature was requested // Require `VK_EXT_texture_compression_astc_hdr` if the associated feature was requested

View File

@ -881,7 +881,7 @@ impl crate::Instance for super::Instance {
{ {
self.create_surface_from_view(handle.ns_view) self.create_surface_from_view(handle.ns_view)
} }
#[cfg(all(target_os = "ios", feature = "metal"))] #[cfg(all(any(target_os = "ios", target_os = "visionos"), feature = "metal"))]
(Rwh::UiKit(handle), _) (Rwh::UiKit(handle), _)
if self.shared.extensions.contains(&ext::metal_surface::NAME) => if self.shared.extensions.contains(&ext::metal_surface::NAME) =>
{ {

View File

@ -150,7 +150,7 @@ features = ["indirect-validation"]
# Enable `wgc` by default on macOS and iOS to allow the `metal` crate feature to # Enable `wgc` by default on macOS and iOS to allow the `metal` crate feature to
# enable the Metal backend while being no-op on other targets. # enable the Metal backend while being no-op on other targets.
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc] [target.'cfg(target_vendor = "apple")'.dependencies.wgc]
workspace = true workspace = true
# We want the wgpu-core Direct3D backend and OpenGL (via WGL) on Windows. # We want the wgpu-core Direct3D backend and OpenGL (via WGL) on Windows.
@ -159,12 +159,12 @@ workspace = true
features = ["gles"] features = ["gles"]
# We want the wgpu-core Vulkan backend on Unix (but not emscripten, macOS, iOS) and Windows. # We want the wgpu-core Vulkan backend on Unix (but not emscripten, macOS, iOS) and Windows.
[target.'cfg(any(windows, all(unix, not(target_os = "emscripten"), not(target_os = "ios"), not(target_os = "macos"))))'.dependencies.wgc] [target.'cfg(any(windows, all(unix, not(target_os = "emscripten"), not(target_vendor = "apple"))))'.dependencies.wgc]
workspace = true workspace = true
features = ["vulkan"] features = ["vulkan"]
# We want the wgpu-core GLES backend on Unix (but not macOS, iOS). # We want the wgpu-core GLES backend on Unix (but not macOS, iOS).
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies.wgc] [target.'cfg(all(unix, not(target_vendor = "apple")))'.dependencies.wgc]
workspace = true workspace = true
features = ["gles"] features = ["gles"]
@ -175,7 +175,7 @@ workspace = true
[target.'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))'.dependencies] [target.'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))'.dependencies]
hal = { workspace = true } hal = { workspace = true }
[target.'cfg(all(not(target_arch = "wasm32"), unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies] [target.'cfg(all(not(target_arch = "wasm32"), unix, not(target_vendor = "apple")))'.dependencies]
hal = { workspace = true, features = ["renderdoc"] } hal = { workspace = true, features = ["renderdoc"] }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]

View File

@ -10,7 +10,7 @@ fn main() {
all(feature = "fragile-send-sync-non-atomic-wasm", not(target_feature = "atomics")) all(feature = "fragile-send-sync-non-atomic-wasm", not(target_feature = "atomics"))
) }, ) },
dx12: { all(target_os = "windows", feature = "dx12") }, dx12: { all(target_os = "windows", feature = "dx12") },
metal: { all(any(target_os = "ios", target_os = "macos"), feature = "metal") }, metal: { all(target_vendor = "apple", feature = "metal") },
// This alias is _only_ if _we_ need naga in the wrapper. wgpu-core provides // This alias is _only_ if _we_ need naga in the wrapper. wgpu-core provides
// its own re-export of naga, which can be used in other situations // its own re-export of naga, which can be used in other situations
naga: { any(feature = "naga-ir", feature = "spirv", feature = "glsl") }, naga: { any(feature = "naga-ir", feature = "spirv", feature = "glsl") },

View File

@ -82,9 +82,7 @@ impl Instance {
} }
// Vulkan on Mac/iOS is only available through vulkan-portability. // Vulkan on Mac/iOS is only available through vulkan-portability.
if (cfg!(target_os = "ios") || cfg!(target_os = "macos")) if cfg!(target_vendor = "apple") && cfg!(feature = "vulkan-portability") {
&& cfg!(feature = "vulkan-portability")
{
backends = backends.union(Backends::VULKAN); backends = backends.union(Backends::VULKAN);
} }