From 548108943651afb23dce068a10e058bed49ef473 Mon Sep 17 00:00:00 2001 From: Guus Waals <_@guusw.nl> Date: Fri, 22 Nov 2024 18:02:56 +0800 Subject: [PATCH 1/7] Add visionos support --- CHANGELOG.md | 1 + deno_webgpu/Cargo.toml | 2 +- naga/build.rs | 2 +- naga/fuzz/Cargo.toml | 4 ++-- naga/fuzz/fuzz_targets/glsl_parser.rs | 2 +- naga/fuzz/fuzz_targets/ir.rs | 2 +- naga/fuzz/fuzz_targets/spv_parser.rs | 2 +- naga/fuzz/fuzz_targets/wgsl_parser.rs | 2 +- naga/xtask/src/validate.rs | 2 +- wgpu-core/build.rs | 2 +- wgpu-core/src/lib.rs | 2 +- wgpu-hal/Cargo.toml | 4 ++-- wgpu-hal/build.rs | 2 +- wgpu-hal/examples/halmark/main.rs | 2 +- wgpu-hal/examples/raw-gles.rs | 6 +++--- wgpu-hal/examples/ray-traced-triangle/main.rs | 2 +- wgpu-hal/src/gles/egl.rs | 4 ++-- wgpu-hal/src/metal/adapter.rs | 2 +- wgpu-hal/src/metal/mod.rs | 2 +- wgpu-hal/src/metal/surface.rs | 2 +- wgpu-hal/src/vulkan/adapter.rs | 2 +- wgpu-hal/src/vulkan/instance.rs | 2 +- wgpu/Cargo.toml | 8 ++++---- wgpu/build.rs | 2 +- 24 files changed, 32 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f482cc829d9..7eea767fad7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,6 +105,7 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148] - Return submission index in `map_async` and `on_submitted_work_done` to track down completion of async callbacks. By @eliemichel in [#6360](https://github.com/gfx-rs/wgpu/pull/6360). - Move raytracing alignments into HAL instead of in core. By @Vecvec in [#6563](https://github.com/gfx-rs/wgpu/pull/6563). +- Add build support for Apple Vision Pro. By @guusw in [#6611](https://github.com/gfx-rs/wgpu/pull/6611). ### Changes diff --git a/deno_webgpu/Cargo.toml b/deno_webgpu/Cargo.toml index ba72507dd7d..83c1acd5ae0 100644 --- a/deno_webgpu/Cargo.toml +++ b/deno_webgpu/Cargo.toml @@ -35,7 +35,7 @@ features = [ ] # 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(any(target_os = "macos", target_os = "ios", target_os = "visionos"))'.dependencies.wgpu-core] workspace = true features = ["metal"] diff --git a/naga/build.rs b/naga/build.rs index e263f626a90..b6367c8c6aa 100644 --- a/naga/build.rs +++ b/naga/build.rs @@ -3,7 +3,7 @@ fn main() { dot_out: { feature = "dot-out" }, glsl_out: { feature = "glsl-out" }, 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(any(target_os = "ios", target_os = "visionos", target_os = "macos"), feature = "msl-out-if-target-apple")) }, spv_out: { feature = "spv-out" }, wgsl_out: { feature = "wgsl-out" }, } diff --git a/naga/fuzz/Cargo.toml b/naga/fuzz/Cargo.toml index f34a6f92e92..09d16615f27 100644 --- a/naga/fuzz/Cargo.toml +++ b/naga/fuzz/Cargo.toml @@ -9,11 +9,11 @@ license = "MIT OR Apache-2.0" [package.metadata] cargo-fuzz = true -[target.'cfg(not(any(target_arch = "wasm32", target_os = "ios")))'.dependencies] +[target.'cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "visionos")))'.dependencies] arbitrary = { version = "1.3.2", features = ["derive"] } libfuzzer-sys = "0.4" -[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 = ".." version = "23.0.0" features = ["arbitrary", "spv-in", "wgsl-in", "glsl-in"] diff --git a/naga/fuzz/fuzz_targets/glsl_parser.rs b/naga/fuzz/fuzz_targets/glsl_parser.rs index aed7ba981b8..b4590915637 100644 --- a/naga/fuzz/fuzz_targets/glsl_parser.rs +++ b/naga/fuzz/fuzz_targets/glsl_parser.rs @@ -1,5 +1,5 @@ #![no_main] -#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))] +#[cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "visionos")))] mod fuzz { use arbitrary::Arbitrary; use libfuzzer_sys::fuzz_target; diff --git a/naga/fuzz/fuzz_targets/ir.rs b/naga/fuzz/fuzz_targets/ir.rs index 6768917c3b5..e473e751b17 100644 --- a/naga/fuzz/fuzz_targets/ir.rs +++ b/naga/fuzz/fuzz_targets/ir.rs @@ -1,5 +1,5 @@ #![no_main] -#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))] +#[cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "visionos")))] mod fuzz { use libfuzzer_sys::fuzz_target; diff --git a/naga/fuzz/fuzz_targets/spv_parser.rs b/naga/fuzz/fuzz_targets/spv_parser.rs index 2b0fae2960f..4d01fecac8f 100644 --- a/naga/fuzz/fuzz_targets/spv_parser.rs +++ b/naga/fuzz/fuzz_targets/spv_parser.rs @@ -1,5 +1,5 @@ #![no_main] -#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))] +#[cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "visionos")))] mod fuzz { use libfuzzer_sys::fuzz_target; use naga::front::spv::{Frontend, Options}; diff --git a/naga/fuzz/fuzz_targets/wgsl_parser.rs b/naga/fuzz/fuzz_targets/wgsl_parser.rs index 7513d63d1db..810cfb55492 100644 --- a/naga/fuzz/fuzz_targets/wgsl_parser.rs +++ b/naga/fuzz/fuzz_targets/wgsl_parser.rs @@ -1,5 +1,5 @@ #![no_main] -#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))] +#[cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "visionos")))] mod fuzz { use libfuzzer_sys::fuzz_target; use naga::front::wgsl::Frontend; diff --git a/naga/xtask/src/validate.rs b/naga/xtask/src/validate.rs index fa330f0a969..17d6b652fd8 100644 --- a/naga/xtask/src/validate.rs +++ b/naga/xtask/src/validate.rs @@ -150,7 +150,7 @@ fn collect_validation_jobs(jobs: &mut Vec, cmd: ValidateSubcommand) -> anyh | ValidateSubcommand::Spirv | ValidateSubcommand::Glsl | ValidateSubcommand::Dot => true, - ValidateSubcommand::Metal => cfg!(any(target_os = "macos", target_os = "ios")), + ValidateSubcommand::Metal => cfg!(any(target_os = "macos", target_os = "ios", target_os = "visionos")), // The FXC compiler is only available on Windows. // // The DXC compiler can be built and run on any platform, diff --git a/wgpu-core/build.rs b/wgpu-core/build.rs index 2f715fdb2a1..710383d54f7 100644 --- a/wgpu-core/build.rs +++ b/wgpu-core/build.rs @@ -7,7 +7,7 @@ fn main() { webgl: { all(target_arch = "wasm32", not(target_os = "emscripten"), gles) }, dx12: { all(target_os = "windows", feature = "dx12") }, gles: { all(feature = "gles") }, - metal: { all(any(target_os = "ios", target_os = "macos"), feature = "metal") }, + metal: { all(any(target_os = "ios", target_os = "visionos", target_os = "macos"), feature = "metal") }, vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") } } } diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index 1edb27e7ab7..e96e942aff6 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -10,7 +10,7 @@ #![cfg_attr( all( 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_os = "macos", target_os = "ios", target_os = "visionos"))), not(all(feature = "dx12", windows)), not(feature = "gles"), ), diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 35e85f45da7..cd77aec5ec1 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -164,7 +164,7 @@ windows-core = { workspace = true, optional = true } # backend: Gles glutin_wgl_sys = { workspace = true, optional = true } -[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies] +[target.'cfg(any(target_os="macos", target_os="ios", target_os="visionos"))'.dependencies] # backend: Metal block = { workspace = true, optional = true } @@ -208,7 +208,7 @@ env_logger.workspace = true glam.workspace = true # for ray-traced-triangle 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 = [ "egl", "wgl", diff --git a/wgpu-hal/build.rs b/wgpu-hal/build.rs index 7d17591605a..fa6054ca301 100644 --- a/wgpu-hal/build.rs +++ b/wgpu-hal/build.rs @@ -9,7 +9,7 @@ fn main() { Emscripten: { all(target_os = "emscripten", gles) }, dx12: { all(target_os = "windows", feature = "dx12") }, gles: { all(feature = "gles") }, - metal: { all(any(target_os = "ios", target_os = "macos"), feature = "metal") }, + metal: { all(any(target_os = "ios", target_os = "visionos", target_os = "macos"), feature = "metal") }, vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") } } } diff --git a/wgpu-hal/examples/halmark/main.rs b/wgpu-hal/examples/halmark/main.rs index 020d362e8ba..c43b7618ebb 100644 --- a/wgpu-hal/examples/halmark/main.rs +++ b/wgpu-hal/examples/halmark/main.rs @@ -782,7 +782,7 @@ impl Example { cfg_if::cfg_if! { // Apple + Metal - if #[cfg(all(any(target_os = "macos", target_os = "ios"), feature = "metal"))] { + if #[cfg(all(any(target_os = "macos", target_os = "ios", target_os = "visionos"), feature = "metal"))] { type Api = hal::api::Metal; } // Wasm + Vulkan diff --git a/wgpu-hal/examples/raw-gles.rs b/wgpu-hal/examples/raw-gles.rs index 2743ce9b823..a316585c3f0 100644 --- a/wgpu-hal/examples/raw-gles.rs +++ b/wgpu-hal/examples/raw-gles.rs @@ -10,7 +10,7 @@ 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() { use std::{ffi::CString, num::NonZeroU32}; @@ -256,7 +256,7 @@ fn main() { #[cfg(any( all(target_arch = "wasm32", not(target_os = "emscripten")), - target_os = "ios" + target_os = "ios", target_os = "visionos" ))] fn main() { eprintln!("This example is not supported on Windows and non-emscripten wasm32") @@ -264,7 +264,7 @@ fn main() { #[cfg(not(any( all(target_arch = "wasm32", not(target_os = "emscripten")), - target_os = "ios" + target_os = "ios", target_os = "visionos" )))] fn fill_screen(exposed: &hal::ExposedAdapter, width: u32, height: u32) { use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _}; diff --git a/wgpu-hal/examples/ray-traced-triangle/main.rs b/wgpu-hal/examples/ray-traced-triangle/main.rs index 7212988f48f..e6c0867c568 100644 --- a/wgpu-hal/examples/ray-traced-triangle/main.rs +++ b/wgpu-hal/examples/ray-traced-triangle/main.rs @@ -1078,7 +1078,7 @@ impl Example { cfg_if::cfg_if! { // Apple + Metal - if #[cfg(all(any(target_os = "macos", target_os = "ios"), feature = "metal"))] { + if #[cfg(all(any(target_os = "macos", target_os = "ios", target_os = "visionos"), feature = "metal"))] { type Api = hal::api::Metal; } // Wasm + Vulkan diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index 42aec2b253d..b550b6c0d90 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -785,7 +785,7 @@ impl crate::Instance for Instance { "libEGL.dll", ) } - } else if cfg!(any(target_os = "macos", target_os = "ios")) { + } else if cfg!(any(target_os = "macos", target_os = "ios", target_os = "visionos")) { unsafe { khronos_egl::DynamicInstance::::load_required_from_filename( "libEGL.dylib", @@ -1313,7 +1313,7 @@ impl crate::Surface for Surface { let window_ptr = handle.ns_view.as_ptr(); #[cfg(target_os = "macos")] let window_ptr = { - use objc::{msg_send, runtime::Object, sel, sel_impl}; + use objc::{msg_send, runtime::Object, sel}; // ns_view always have a layer and don't need to verify that it exists. let layer: *mut Object = msg_send![handle.ns_view.as_ptr().cast::(), layer]; diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index fa7622a372e..7be3c4eb7e0 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -1,5 +1,5 @@ use metal::{MTLFeatureSet, MTLGPUFamily, MTLLanguageVersion, MTLReadWriteTextureTier}; -use objc::{class, msg_send, sel, sel_impl}; +use objc::{class, msg_send, sel}; use parking_lot::Mutex; use wgt::{AstcBlock, AstcChannel}; diff --git a/wgpu-hal/src/metal/mod.rs b/wgpu-hal/src/metal/mod.rs index 1935e843ec6..aef28ef2954 100644 --- a/wgpu-hal/src/metal/mod.rs +++ b/wgpu-hal/src/metal/mod.rs @@ -120,7 +120,7 @@ impl crate::Instance for Instance { window_handle: raw_window_handle::RawWindowHandle, ) -> Result { match window_handle { - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "ios", target_os = "visionos"))] raw_window_handle::RawWindowHandle::UiKit(handle) => { Ok(unsafe { Surface::from_view(handle.ui_view.cast()) }) } diff --git a/wgpu-hal/src/metal/surface.rs b/wgpu-hal/src/metal/surface.rs index b35c73c9102..17d4561cc7b 100644 --- a/wgpu-hal/src/metal/surface.rs +++ b/wgpu-hal/src/metal/surface.rs @@ -16,7 +16,7 @@ use objc::{ msg_send, rc::{autoreleasepool, StrongPtr}, runtime::{Class, Object, Sel, BOOL, NO, YES}, - sel, sel_impl, + sel }; use parking_lot::{Mutex, RwLock}; diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 6e88e03b8c2..962d99a53e7 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1005,7 +1005,7 @@ impl PhysicalDeviceProperties { } // Require `VK_KHR_portability_subset` on macOS/iOS - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "visionos"))] extensions.push(khr::portability_subset::NAME); // Require `VK_EXT_texture_compression_astc_hdr` if the associated feature was requested diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 6ec300ec77e..19b17d127f3 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -881,7 +881,7 @@ impl crate::Instance for super::Instance { { 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), _) if self.shared.extensions.contains(&ext::metal_surface::NAME) => { diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index ed630133e23..7feacd700d8 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -138,7 +138,7 @@ features = ["indirect-validation"] # 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. -[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc] +[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "visionos"))'.dependencies.wgc] workspace = true # We want the wgpu-core Direct3D backend and OpenGL (via WGL) on Windows. @@ -147,12 +147,12 @@ workspace = true features = ["gles"] # 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_os = "ios"), not(target_os = "visionos"), not(target_os = "macos"))))'.dependencies.wgc] workspace = true features = ["vulkan"] # 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_os = "ios"), not(target_os = "visionos"), not(target_os = "macos")))'.dependencies.wgc] workspace = true features = ["gles"] @@ -163,7 +163,7 @@ workspace = true [target.'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))'.dependencies] 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_os = "ios"), not(target_os = "visionos"), not(target_os = "macos")))'.dependencies] hal = { workspace = true, features = ["renderdoc"] } [target.'cfg(windows)'.dependencies] diff --git a/wgpu/build.rs b/wgpu/build.rs index 1f07f7ebba5..0354a9e08fe 100644 --- a/wgpu/build.rs +++ b/wgpu/build.rs @@ -10,7 +10,7 @@ fn main() { all(feature = "fragile-send-sync-non-atomic-wasm", not(target_feature = "atomics")) ) }, dx12: { all(target_os = "windows", feature = "dx12") }, - metal: { all(any(target_os = "ios", target_os = "macos"), feature = "metal") }, + metal: { all(any(target_os = "ios", target_os = "visionos", target_os = "macos"), feature = "metal") }, // 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 naga: { any(feature = "naga-ir", feature = "spirv", feature = "glsl") }, From 8b67f78954ee788b23556102822be0f64dfd9c8b Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Thu, 9 Jan 2025 13:45:19 -0500 Subject: [PATCH 2/7] Use `target_vendor = "apple"` --- .github/workflows/ci.yml | 6 ++++++ deno_webgpu/Cargo.toml | 2 +- naga/build.rs | 2 +- wgpu-core/build.rs | 2 +- wgpu-core/src/lib.rs | 2 +- wgpu-hal/build.rs | 2 +- wgpu-hal/examples/halmark/main.rs | 2 +- wgpu-hal/examples/raw-gles.rs | 4 ++-- wgpu-hal/examples/ray-traced-triangle/main.rs | 2 +- wgpu-hal/src/gles/egl.rs | 2 +- wgpu-hal/src/metal/surface.rs | 2 +- wgpu-hal/src/vulkan/adapter.rs | 2 +- wgpu/Cargo.toml | 8 ++++---- wgpu/build.rs | 2 +- wgpu/src/api/instance.rs | 4 +--- 15 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a10a2d0d9d7..9188c7ac167 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,6 +111,12 @@ jobs: target: aarch64-apple-ios kind: native + # VisionOS + - name: VisionOS aarch64 + os: macos-14 + target: aarch64-apple-visionos + kind: native + # Linux - name: Linux x86_64 os: ubuntu-22.04 diff --git a/deno_webgpu/Cargo.toml b/deno_webgpu/Cargo.toml index 05c0152244d..d8776c0d408 100644 --- a/deno_webgpu/Cargo.toml +++ b/deno_webgpu/Cargo.toml @@ -36,7 +36,7 @@ features = [ ] # We want the wgpu-core Metal backend on macOS and iOS. -[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "visionos"))'.dependencies.wgpu-core] +[target.'cfg(target_vendor = "apple")'.dependencies.wgpu-core] workspace = true features = ["metal"] diff --git a/naga/build.rs b/naga/build.rs index b6367c8c6aa..e647f1fdd0a 100644 --- a/naga/build.rs +++ b/naga/build.rs @@ -3,7 +3,7 @@ fn main() { dot_out: { feature = "dot-out" }, glsl_out: { feature = "glsl-out" }, 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 = "visionos", 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" }, wgsl_out: { feature = "wgsl-out" }, } diff --git a/wgpu-core/build.rs b/wgpu-core/build.rs index 710383d54f7..0462725326f 100644 --- a/wgpu-core/build.rs +++ b/wgpu-core/build.rs @@ -7,7 +7,7 @@ fn main() { webgl: { all(target_arch = "wasm32", not(target_os = "emscripten"), gles) }, dx12: { all(target_os = "windows", feature = "dx12") }, gles: { all(feature = "gles") }, - metal: { all(any(target_os = "ios", target_os = "visionos", target_os = "macos"), feature = "metal") }, + metal: { all(any(target_vendor = "apple"), feature = "metal") }, vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") } } } diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index eaa3cf34e62..5bab0ee2a28 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -10,7 +10,7 @@ #![cfg_attr( all( not(all(feature = "vulkan", not(target_arch = "wasm32"))), - not(all(feature = "metal", any(target_os = "macos", target_os = "ios", target_os = "visionos"))), + not(all(feature = "metal", any(target_vendor = "apple"))), not(all(feature = "dx12", windows)), not(feature = "gles"), ), diff --git a/wgpu-hal/build.rs b/wgpu-hal/build.rs index 510f2a35f61..12e2700b19b 100644 --- a/wgpu-hal/build.rs +++ b/wgpu-hal/build.rs @@ -9,7 +9,7 @@ fn main() { Emscripten: { all(target_os = "emscripten", gles) }, dx12: { all(target_os = "windows", feature = "dx12") }, gles: { all(feature = "gles") }, - metal: { all(any(target_os = "ios", target_os = "macos"), feature = "metal") }, + metal: { all(any(target_vendor = "apple"), feature = "metal") }, vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") }, // ⚠️ 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")) } diff --git a/wgpu-hal/examples/halmark/main.rs b/wgpu-hal/examples/halmark/main.rs index 125299917c1..32a58cacbe7 100644 --- a/wgpu-hal/examples/halmark/main.rs +++ b/wgpu-hal/examples/halmark/main.rs @@ -797,7 +797,7 @@ impl Example { cfg_if::cfg_if! { // Apple + Metal - if #[cfg(all(any(target_os = "macos", target_os = "ios", target_os = "visionos"), feature = "metal"))] { + if #[cfg(all(any(target_vendor = "apple"), feature = "metal"))] { type Api = hal::api::Metal; } // Wasm + Vulkan diff --git a/wgpu-hal/examples/raw-gles.rs b/wgpu-hal/examples/raw-gles.rs index a316585c3f0..bd0aee5a5e2 100644 --- a/wgpu-hal/examples/raw-gles.rs +++ b/wgpu-hal/examples/raw-gles.rs @@ -256,7 +256,7 @@ fn main() { #[cfg(any( all(target_arch = "wasm32", not(target_os = "emscripten")), - target_os = "ios", target_os = "visionos" + target_vendor = "apple" ))] fn main() { eprintln!("This example is not supported on Windows and non-emscripten wasm32") @@ -264,7 +264,7 @@ fn main() { #[cfg(not(any( all(target_arch = "wasm32", not(target_os = "emscripten")), - target_os = "ios", target_os = "visionos" + target_vendor = "apple" )))] fn fill_screen(exposed: &hal::ExposedAdapter, width: u32, height: u32) { use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _}; diff --git a/wgpu-hal/examples/ray-traced-triangle/main.rs b/wgpu-hal/examples/ray-traced-triangle/main.rs index 6573e39f1c7..58022404613 100644 --- a/wgpu-hal/examples/ray-traced-triangle/main.rs +++ b/wgpu-hal/examples/ray-traced-triangle/main.rs @@ -1107,7 +1107,7 @@ impl Example { cfg_if::cfg_if! { // Apple + Metal - if #[cfg(all(any(target_os = "macos", target_os = "ios", target_os = "visionos"), feature = "metal"))] { + if #[cfg(all(any(target_vendor = "apple"), feature = "metal"))] { type Api = hal::api::Metal; } // Wasm + Vulkan diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index b550b6c0d90..d37c56cec36 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -785,7 +785,7 @@ impl crate::Instance for Instance { "libEGL.dll", ) } - } else if cfg!(any(target_os = "macos", target_os = "ios", target_os = "visionos")) { + } else if cfg!(target_vendor = "apple") { unsafe { khronos_egl::DynamicInstance::::load_required_from_filename( "libEGL.dylib", diff --git a/wgpu-hal/src/metal/surface.rs b/wgpu-hal/src/metal/surface.rs index 17d4561cc7b..4a26358adae 100644 --- a/wgpu-hal/src/metal/surface.rs +++ b/wgpu-hal/src/metal/surface.rs @@ -16,7 +16,7 @@ use objc::{ msg_send, rc::{autoreleasepool, StrongPtr}, runtime::{Class, Object, Sel, BOOL, NO, YES}, - sel + sel, }; use parking_lot::{Mutex, RwLock}; diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index e5f8a2e24ff..cde18162eae 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1003,7 +1003,7 @@ impl PhysicalDeviceProperties { } // Require `VK_KHR_portability_subset` on macOS/iOS - #[cfg(any(target_os = "macos", target_os = "ios", target_os = "visionos"))] + #[cfg(target_vendor = "apple")] extensions.push(khr::portability_subset::NAME); // Require `VK_EXT_texture_compression_astc_hdr` if the associated feature was requested diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index d5e043b6b35..f09008959bd 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -150,7 +150,7 @@ features = ["indirect-validation"] # 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. -[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "visionos"))'.dependencies.wgc] +[target.'cfg(target_vendor = "apple")'.dependencies.wgc] workspace = true # We want the wgpu-core Direct3D backend and OpenGL (via WGL) on Windows. @@ -159,12 +159,12 @@ workspace = true features = ["gles"] # 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 = "visionos"), not(target_os = "macos"))))'.dependencies.wgc] +[target.'cfg(any(windows, all(unix, not(target_os = "emscripten"), not(target_vendor = "apple"))))'.dependencies.wgc] workspace = true features = ["vulkan"] # We want the wgpu-core GLES backend on Unix (but not macOS, iOS). -[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "visionos"), not(target_os = "macos")))'.dependencies.wgc] +[target.'cfg(all(unix, not(target_vendor = "apple")))'.dependencies.wgc] workspace = true features = ["gles"] @@ -175,7 +175,7 @@ workspace = true [target.'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))'.dependencies] hal = { workspace = true } -[target.'cfg(all(not(target_arch = "wasm32"), unix, not(target_os = "ios"), not(target_os = "visionos"), not(target_os = "macos")))'.dependencies] +[target.'cfg(all(not(target_arch = "wasm32"), unix, not(target_vendor = "apple")))'.dependencies] hal = { workspace = true, features = ["renderdoc"] } [target.'cfg(windows)'.dependencies] diff --git a/wgpu/build.rs b/wgpu/build.rs index efb5efcecb4..d853281dfa4 100644 --- a/wgpu/build.rs +++ b/wgpu/build.rs @@ -10,7 +10,7 @@ fn main() { all(feature = "fragile-send-sync-non-atomic-wasm", not(target_feature = "atomics")) ) }, dx12: { all(target_os = "windows", feature = "dx12") }, - metal: { all(any(target_os = "ios", target_os = "visionos", 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 // its own re-export of naga, which can be used in other situations naga: { any(feature = "naga-ir", feature = "spirv", feature = "glsl") }, diff --git a/wgpu/src/api/instance.rs b/wgpu/src/api/instance.rs index 4b1b6b901f6..2d281663365 100644 --- a/wgpu/src/api/instance.rs +++ b/wgpu/src/api/instance.rs @@ -65,9 +65,7 @@ impl Instance { } // Vulkan on Mac/iOS is only available through vulkan-portability. - if (cfg!(target_os = "ios") || cfg!(target_os = "macos")) - && cfg!(feature = "vulkan-portability") - { + if cfg!(target_vendor = "apple") && cfg!(feature = "vulkan-portability") { backends = backends.union(Backends::VULKAN); } From bd8a5bde01c4197a1d62953bcbda45e650bd68f1 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Thu, 9 Jan 2025 14:04:05 -0500 Subject: [PATCH 3/7] Fixes --- naga/xtask/src/validate.rs | 2 +- wgpu-core/build.rs | 2 +- wgpu-hal/Cargo.toml | 2 +- wgpu-hal/build.rs | 2 +- wgpu-hal/examples/halmark/main.rs | 2 +- wgpu-hal/examples/ray-traced-triangle/main.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/naga/xtask/src/validate.rs b/naga/xtask/src/validate.rs index cafe93c1c56..2006aa83ae2 100644 --- a/naga/xtask/src/validate.rs +++ b/naga/xtask/src/validate.rs @@ -150,7 +150,7 @@ fn collect_validation_jobs(jobs: &mut Vec, cmd: ValidateSubcommand) -> anyh | ValidateSubcommand::Spirv | ValidateSubcommand::Glsl | ValidateSubcommand::Dot => true, - ValidateSubcommand::Metal => cfg!(any(target_os = "macos", target_os = "ios", target_os = "visionos")), + ValidateSubcommand::Metal => cfg!(target_vendor = "apple"), // The FXC compiler is only available on Windows. // // The DXC compiler can be built and run on any platform, diff --git a/wgpu-core/build.rs b/wgpu-core/build.rs index 0462725326f..4d35481678c 100644 --- a/wgpu-core/build.rs +++ b/wgpu-core/build.rs @@ -7,7 +7,7 @@ fn main() { webgl: { all(target_arch = "wasm32", not(target_os = "emscripten"), gles) }, dx12: { all(target_os = "windows", feature = "dx12") }, gles: { all(feature = "gles") }, - metal: { all(any(target_vendor = "apple"), feature = "metal") }, + metal: { all(target_vendor = "apple", feature = "metal") }, vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") } } } diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index cf868e4eff7..ed4df09e15e 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -177,7 +177,7 @@ glutin_wgl_sys = { workspace = true, optional = true } [target.'cfg(all(windows, not(target_arch = "aarch64")))'.dependencies] 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 block = { workspace = true, optional = true } diff --git a/wgpu-hal/build.rs b/wgpu-hal/build.rs index 12e2700b19b..9a648c60eaa 100644 --- a/wgpu-hal/build.rs +++ b/wgpu-hal/build.rs @@ -9,7 +9,7 @@ fn main() { Emscripten: { all(target_os = "emscripten", gles) }, dx12: { all(target_os = "windows", feature = "dx12") }, gles: { all(feature = "gles") }, - metal: { all(any(target_vendor = "apple"), feature = "metal") }, + metal: { all(target_vendor = "apple", feature = "metal") }, vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") }, // ⚠️ 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")) } diff --git a/wgpu-hal/examples/halmark/main.rs b/wgpu-hal/examples/halmark/main.rs index 32a58cacbe7..22612036825 100644 --- a/wgpu-hal/examples/halmark/main.rs +++ b/wgpu-hal/examples/halmark/main.rs @@ -797,7 +797,7 @@ impl Example { cfg_if::cfg_if! { // Apple + Metal - if #[cfg(all(any(target_vendor = "apple"), feature = "metal"))] { + if #[cfg(all(target_vendor = "apple", feature = "metal"))] { type Api = hal::api::Metal; } // Wasm + Vulkan diff --git a/wgpu-hal/examples/ray-traced-triangle/main.rs b/wgpu-hal/examples/ray-traced-triangle/main.rs index 58022404613..be077b72bf9 100644 --- a/wgpu-hal/examples/ray-traced-triangle/main.rs +++ b/wgpu-hal/examples/ray-traced-triangle/main.rs @@ -1107,7 +1107,7 @@ impl Example { cfg_if::cfg_if! { // Apple + Metal - if #[cfg(all(any(target_vendor = "apple"), feature = "metal"))] { + if #[cfg(all(target_vendor = "apple", feature = "metal"))] { type Api = hal::api::Metal; } // Wasm + Vulkan From 0e156df853de560d0e9beba361f6752b0ef621f6 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Thu, 9 Jan 2025 15:19:42 -0500 Subject: [PATCH 4/7] Build VisionOS --- .github/workflows/ci.yml | 53 +++++++++++++++++++++-------------- wgpu-hal/examples/raw-gles.rs | 6 ++-- wgpu-hal/src/gles/egl.rs | 2 +- wgpu-hal/src/metal/adapter.rs | 2 +- wgpu-hal/src/metal/surface.rs | 2 +- 5 files changed, 39 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9188c7ac167..46627dae3d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ env: # We sometimes need nightly to use special things in CI. # # In order to prevent CI regressions, we pin the nightly version. - NIGHTLY_VERSION: "nightly-2024-10-10" + NIGHTLY_VERSION: "nightly-2024-09-05" # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. REPO_MSRV: "1.83" # This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates, @@ -115,7 +115,9 @@ jobs: - name: VisionOS aarch64 os: macos-14 target: aarch64-apple-visionos - kind: native + kind: wgpu-only + toolchain: nightly + extra-flags: -Zbuild-std # Linux - name: Linux x86_64 @@ -143,7 +145,7 @@ jobs: - name: Emscripten os: ubuntu-22.04 target: wasm32-unknown-emscripten - kind: em + kind: wgpu-only name: Clippy ${{ matrix.name }} runs-on: ${{ matrix.os }} @@ -152,12 +154,21 @@ jobs: - name: checkout repo uses: actions/checkout@v4 - - name: Install Repo MSRV toolchain + - name: Install Toolchain (Repo MSRV) + if: matrix.toolchain != 'nightly' 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 }} cargo -V + - name: Install Toolchain (Nightly) + if: matrix.toolchain == 'nightly' + run: | + rustup toolchain install ${{ env.NIGHTLY_VERSION }} --no-self-update --profile=minimal --component clippy,rust-src + rustup override set ${{ env.NIGHTLY_VERSION }} + cargo -V + - name: disable debug shell: bash run: | @@ -196,28 +207,28 @@ jobs: set -e # build for WebGPU - cargo clippy --target ${{ matrix.target }} --tests --features glsl,spirv,fragile-send-sync-non-atomic-wasm - cargo clippy --target ${{ matrix.target }} --tests --features glsl,spirv - cargo doc --target ${{ matrix.target }} --no-deps --features glsl,spirv + cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --features glsl,spirv,fragile-send-sync-non-atomic-wasm + cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --features glsl,spirv + cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} --no-deps --features glsl,spirv # all features - cargo clippy --target ${{ matrix.target }} --tests --all-features - cargo doc --target ${{ matrix.target }} --no-deps --all-features + cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --all-features + cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} --no-deps --all-features - - name: check em - if: matrix.kind == 'em' + - name: check wgpu only + if: matrix.kind == 'wgpu-only' shell: bash run: | set -e - # build for Emscripten - cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features + # check with no 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. - # all features - cargo clippy --target ${{ matrix.target }} -p wgpu-hal --all-features - cargo clippy --target ${{ matrix.target }} -p wgpu --all-features + # Check with all features. + cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu-hal --all-features + cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu --all-features - name: check native if: matrix.kind == 'native' @@ -226,13 +237,13 @@ jobs: set -e # 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. - cargo clippy --target ${{ matrix.target }} --tests --benches --all-features + cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --benches --all-features # 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 if: matrix.kind == 'native' @@ -241,7 +252,7 @@ jobs: set -e # wgpu_core package - cargo doc --target ${{ matrix.target }} \ + cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} \ --package wgpu-core \ --package wgpu-hal \ --package naga \ diff --git a/wgpu-hal/examples/raw-gles.rs b/wgpu-hal/examples/raw-gles.rs index bd0aee5a5e2..bd086c2dce4 100644 --- a/wgpu-hal/examples/raw-gles.rs +++ b/wgpu-hal/examples/raw-gles.rs @@ -256,7 +256,8 @@ fn main() { #[cfg(any( all(target_arch = "wasm32", not(target_os = "emscripten")), - target_vendor = "apple" + target_os = "ios", + target_os = "visionos" ))] fn main() { eprintln!("This example is not supported on Windows and non-emscripten wasm32") @@ -264,7 +265,8 @@ fn main() { #[cfg(not(any( all(target_arch = "wasm32", not(target_os = "emscripten")), - target_vendor = "apple" + target_os = "ios", + target_os = "visionos" )))] fn fill_screen(exposed: &hal::ExposedAdapter, width: u32, height: u32) { use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _}; diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index d37c56cec36..24d5a125b4c 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -1313,7 +1313,7 @@ impl crate::Surface for Surface { let window_ptr = handle.ns_view.as_ptr(); #[cfg(target_os = "macos")] let window_ptr = { - use objc::{msg_send, runtime::Object, sel}; + use objc::{msg_send, runtime::Object, sel, sel_impl}; // ns_view always have a layer and don't need to verify that it exists. let layer: *mut Object = msg_send![handle.ns_view.as_ptr().cast::(), layer]; diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index 0e51a48fe75..c2a9541bee9 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -1,5 +1,5 @@ use metal::{MTLFeatureSet, MTLGPUFamily, MTLLanguageVersion, MTLReadWriteTextureTier}; -use objc::{class, msg_send, sel}; +use objc::{class, msg_send, sel, sel_impl}; use parking_lot::Mutex; use wgt::{AstcBlock, AstcChannel}; diff --git a/wgpu-hal/src/metal/surface.rs b/wgpu-hal/src/metal/surface.rs index 4a26358adae..b35c73c9102 100644 --- a/wgpu-hal/src/metal/surface.rs +++ b/wgpu-hal/src/metal/surface.rs @@ -16,7 +16,7 @@ use objc::{ msg_send, rc::{autoreleasepool, StrongPtr}, runtime::{Class, Object, Sel, BOOL, NO, YES}, - sel, + sel, sel_impl, }; use parking_lot::{Mutex, RwLock}; From 4be29a181f0614cde730ab62086ab0194fca3099 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Thu, 9 Jan 2025 17:11:54 -0500 Subject: [PATCH 5/7] Gah --- .github/workflows/ci.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46627dae3d6..d7b661599e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ env: # We sometimes need nightly to use special things in CI. # # In order to prevent CI regressions, we pin the nightly version. - NIGHTLY_VERSION: "nightly-2024-09-05" + NIGHTLY_VERSION: "nightly-2024-10-17" # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. REPO_MSRV: "1.83" # This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates, @@ -155,19 +155,17 @@ jobs: uses: actions/checkout@v4 - name: Install Toolchain (Repo MSRV) - if: matrix.toolchain != 'nightly' run: | 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 }} cargo -V - - name: Install Toolchain (Nightly) + - name: Pretend Stable is Nightly if: matrix.toolchain == 'nightly' run: | - rustup toolchain install ${{ env.NIGHTLY_VERSION }} --no-self-update --profile=minimal --component clippy,rust-src - rustup override set ${{ env.NIGHTLY_VERSION }} - cargo -V + rustup component add rust-src --toolchain ${{ env.REPO_MSRV }} + echo "RUST_BOOTSTRAP=1" >> "$GITHUB_ENV" - name: disable debug shell: bash @@ -200,6 +198,7 @@ jobs: # the android sdk doesn't use the conventional name for ar, so explicitly set it. 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 if: matrix.kind == 'web' shell: bash @@ -215,6 +214,7 @@ jobs: cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --all-features cargo doc --target ${{ matrix.target }} ${{ matrix.extra-flags }} --no-deps --all-features + # Building for platforms where the tests do not compile. - name: check wgpu only if: matrix.kind == 'wgpu-only' shell: bash @@ -230,6 +230,7 @@ jobs: cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu-hal --all-features cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu --all-features + # Building for native platforms with standard tests. - name: check native if: matrix.kind == 'native' shell: bash From 39b03592c77fda5c0321cf621f72eb173a89d605 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Thu, 9 Jan 2025 17:21:26 -0500 Subject: [PATCH 6/7] Bleh --- .github/workflows/ci.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7b661599e3..bdcb0aa4453 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,16 +155,28 @@ jobs: uses: actions/checkout@v4 - name: Install Toolchain (Repo MSRV) + if: matrix.toolchain != 'nightly' run: | 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 }} cargo -V - - name: Pretend Stable is Nightly + # 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 RUST_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 RUST_BOOTSTRAP=1, we get access to all the nice + # nightly features without needing to go through the hassle of maintaining a nightly toolchain. + # + # RUST_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 component add rust-src --toolchain ${{ env.REPO_MSRV }} + rustup toolchain install ${{ env.REPO_MSRV }} --no-self-update --profile=minimal --component clippy,rust-src echo "RUST_BOOTSTRAP=1" >> "$GITHUB_ENV" - name: disable debug From fb626e8a615337bcc3ab11c0591bff0f829db15b Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Thu, 9 Jan 2025 17:23:08 -0500 Subject: [PATCH 7/7] Typos --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdcb0aa4453..df8b3dba2ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -163,21 +163,21 @@ jobs: 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 RUST_BOOTSTRAP=1. + # 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 RUST_BOOTSTRAP=1, we get access to all the nice + # 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. # - # RUST_BOOTSTRAP=1 is how the rust project builds itself when bootstrapping the compiler, so while not "stable" + # 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 "RUST_BOOTSTRAP=1" >> "$GITHUB_ENV" + echo "RUSTC_BOOTSTRAP=1" >> "$GITHUB_ENV" - name: disable debug shell: bash