diff --git a/Cargo.lock b/Cargo.lock index 32b040975b..592d478a34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "ab_glyph" @@ -24,17 +24,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - [[package]] name = "ahash" version = "0.8.11" @@ -98,14 +87,13 @@ checksum = "5ecc8056bf6ab9892dcd53216c83d1597487d7dacac16c8df6b877d127df9937" [[package]] name = "android_logger" -version = "0.13.3" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c494134f746c14dc653a35a4ea5aca24ac368529da5370ecf41fe0341c35772f" +checksum = "05b07e8e73d720a1f2e4b6014766e6039fd2e96a4fa44e2a78d0e1fa2ff49826" dependencies = [ "android_log-sys", - "env_logger 0.10.2", + "env_filter", "log", - "once_cell", ] [[package]] @@ -196,44 +184,35 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" -[[package]] -name = "ash" -version = "0.37.3+1.3.251" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" -dependencies = [ - "libloading 0.7.4", -] - [[package]] name = "ash" version = "0.38.0+1.3.281" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" dependencies = [ - "libloading 0.8.6", + "libloading", ] [[package]] name = "ash-molten" -version = "0.13.1+1.1.10" +version = "0.20.0+1.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f01aab261481bd870f4a4e44de72894b1721a5f9f25e5fbd79c9612d1d1605" +checksum = "0b4c4960621009149a2877457f6875185b894fe1b4f7a602167a3ac00758dc40" dependencies = [ "anyhow", - "ash 0.37.3+1.3.251", + "ash", "plist", "serde", ] [[package]] name = "ash-window" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b912285a7c29f3a8f87ca6f55afc48768624e5e33ec17dbd2f2075903f5e35ab" +checksum = "52bca67b61cb81e5553babde81b8211f713cb6db79766f80168f3e5f40ea6c82" dependencies = [ - "ash 0.37.3+1.3.251", - "raw-window-handle 0.5.2", + "ash", + "raw-window-handle 0.6.2", "raw-window-metal", ] @@ -422,7 +401,7 @@ version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.90", @@ -705,7 +684,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017" dependencies = [ "bitflags 2.6.0", - "libloading 0.8.6", + "libloading", "winapi", ] @@ -770,7 +749,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.6", + "libloading", ] [[package]] @@ -814,16 +793,6 @@ dependencies = [ "regex", ] -[[package]] -name = "env_logger" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" -dependencies = [ - "log", - "regex", -] - [[package]] name = "env_logger" version = "0.11.5" @@ -857,12 +826,12 @@ dependencies = [ name = "example-runner-ash" version = "0.0.0" dependencies = [ - "ash 0.37.3+1.3.251", + "ash", "ash-molten", "ash-window", "cfg-if", "clap", - "raw-window-handle 0.5.2", + "raw-window-handle 0.6.2", "shared", "spirv-builder", "winit", @@ -888,7 +857,7 @@ dependencies = [ "clap", "console_error_panic_hook", "console_log", - "env_logger 0.11.5", + "env_logger", "futures", "shared", "spirv-builder", @@ -1212,22 +1181,13 @@ dependencies = [ "bitflags 2.6.0", ] -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.8", -] - [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash 0.8.11", + "ahash", "allocator-api2", ] @@ -1249,18 +1209,12 @@ dependencies = [ "bitflags 2.6.0", "com", "libc", - "libloading 0.8.6", + "libloading", "thiserror", "widestring", "winapi", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -1314,9 +1268,9 @@ dependencies = [ [[package]] name = "inotify" -version = "0.9.6" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" +checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc" dependencies = [ "bitflags 1.3.2", "inotify-sys", @@ -1419,7 +1373,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" dependencies = [ "libc", - "libloading 0.8.6", + "libloading", "pkg-config", ] @@ -1461,16 +1415,6 @@ version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - [[package]] name = "libloading" version = "0.8.6" @@ -1617,14 +1561,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.11" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", "log", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1718,20 +1662,30 @@ dependencies = [ [[package]] name = "notify" -version = "5.2.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729f63e1ca555a43fe3efa4f3efdf4801c479da85b432242a7b726f353c88486" +checksum = "c533b4c39709f9ba5005d8002048266593c1cfaf3c5f0739d5b8ab0c6c504009" dependencies = [ - "bitflags 1.3.2", - "crossbeam-channel", + "bitflags 2.6.0", "filetime", "fsevent-sys", "inotify", "kqueue", "libc", + "log", "mio", + "notify-types", "walkdir", - "windows-sys 0.45.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "notify-types" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585d3cb5e12e01aed9e8a1f70d5c6b5e86fe2a6e48fc8cd0b3e0b8df6f6eb174" +dependencies = [ + "instant", ] [[package]] @@ -2062,14 +2016,14 @@ checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" [[package]] name = "raw-window-metal" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac4ea493258d54c24cb46aa9345d099e58e2ea3f30dd63667fc54fc892f18e76" +checksum = "76e8caa82e31bb98fee12fa8f051c94a6aa36b07cddb03f0d4fc558988360ff1" dependencies = [ "cocoa", "core-graphics", "objc", - "raw-window-handle 0.5.2", + "raw-window-handle 0.6.2", ] [[package]] @@ -2189,22 +2143,23 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" name = "rustc_codegen_spirv" version = "0.9.0" dependencies = [ + "ahash", "ar", + "bytemuck", "either", - "hashbrown 0.11.2", "indexmap", "itertools", "lazy_static", "libc", - "num-traits", + "log", "object", - "once_cell", "pipe", "pretty_assertions", "regex", "rspirv", "rustc-demangle", "rustc_codegen_spirv-types", + "rustix", "sanitize-filename", "smallvec", "spirt", @@ -2250,8 +2205,10 @@ checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags 2.6.0", "errno", + "itoa", "libc", "linux-raw-sys", + "once_cell", "windows-sys 0.59.0", ] @@ -2587,20 +2544,20 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.25.0" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "rustversion", @@ -3222,7 +3179,7 @@ checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f" dependencies = [ "android_system_properties", "arrayvec", - "ash 0.38.0+1.3.281", + "ash", "bit-set", "bitflags 2.6.0", "block", @@ -3238,7 +3195,7 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.6", + "libloading", "log", "metal", "naga", @@ -3344,6 +3301,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.59.0" @@ -3537,7 +3503,7 @@ version = "0.29.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d59ad965a635657faf09c8f062badd885748428933dad8e8bdd64064d92e5ca" dependencies = [ - "ahash 0.8.11", + "ahash", "android-activity", "atomic-waker", "bitflags 2.6.0", @@ -3609,7 +3575,7 @@ dependencies = [ "as-raw-xcb-connection", "gethostname", "libc", - "libloading 0.8.6", + "libloading", "once_cell", "rustix", "x11rb-protocol", diff --git a/crates/rustc_codegen_spirv/Cargo.toml b/crates/rustc_codegen_spirv/Cargo.toml index 5c42e1077b..0fdca9a155 100644 --- a/crates/rustc_codegen_spirv/Cargo.toml +++ b/crates/rustc_codegen_spirv/Cargo.toml @@ -33,11 +33,11 @@ skip-toolchain-check = [] [dependencies] # HACK(eddyb) these only exist to unify features across dependency trees, # in order to avoid multiple separate instances of `rustc_codegen_spirv`. -hashbrown = "0.11" -libc = { version = "0.2", features = ["align", "extra_traits"] } -num-traits = { workspace = true, default-features = true } -once_cell = "1" +ahash = { version = "0.8.11", features = ["no-rng"] } +bytemuck = { version = "1.20.0", features = ["aarch64_simd", "derive"] } +log = { version = "0.4.22", features = ["std"] } regex = { version = "1", features = ["perf"] } +rustix = { version = "0.38.42", features = ["all-apis"] } # HACK(eddyb) deps of `rustc_codegen_ssa`, for `pqp_cg_ssa` (see `build.rs`), # that cannot be handled with just `extern crate` pulling out of the sysroot. @@ -52,7 +52,7 @@ rspirv = "0.12" rustc_codegen_spirv-types.workspace = true rustc-demangle = "0.1.21" sanitize-filename = "0.4" -smallvec = { version = "1.6.1", features = ["union"] } +smallvec = { version = "1.6.1", features = ["const_generics", "const_new", "union"] } spirt = "0.4.0" spirv-tools.workspace = true lazy_static = "1.4.0" @@ -66,6 +66,11 @@ pretty_assertions = "1.0" # (see `build.rs`). # tempfile = "3.4" +# HACK(eddyb) deps of `rustc_codegen_ssa`, for `pqp_cg_ssa` (see `build.rs`), +# that cannot be handled with just `extern crate` pulling out of the sysroot. +[target.'cfg(unix)'.dependencies] +libc = "0.2.50" + # Note that in order to use RA and have access to `rustc_*` crates, you also # need to set `"rust-analyzer.rustcSource": "discover"` in e.g. VSCode. [package.metadata.rust-analyzer] diff --git a/crates/spirv-builder/Cargo.toml b/crates/spirv-builder/Cargo.toml index 0b52ffd739..125bcbe72d 100644 --- a/crates/spirv-builder/Cargo.toml +++ b/crates/spirv-builder/Cargo.toml @@ -39,4 +39,4 @@ raw-string = "0.3.5" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -notify = { version = "5.0.0-pre.11", optional = true } +notify = { version = "7.0", optional = true } diff --git a/deny.toml b/deny.toml index 4d3bb20c52..f996cff704 100644 --- a/deny.toml +++ b/deny.toml @@ -26,18 +26,32 @@ deny = [ # Certain crates/versions that will be skipped when doing duplicate detection. skip = [ #{ name = "ansi_term", version = "=0.11.0" }, + + # HACK(eddyb) two versions coexist for interop, for the time being. + { name = "raw-window-handle", version = "=0.5.2" }, + { name = "raw-window-handle", version = "=0.6.2" }, + + # HACK(eddyb) the newer version hasn't propagated through the ecosystem yet. + { name = "hashbrown", version = "=0.14.5" }, + { name = "hashbrown", version = "=0.15.2" }, ] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive # dependencies starting at the specified crate, up to a certain depth, which is # by default infinite skip-tree = [ - # we don't really care if our example brings in some duplicate dependencies, for now - { name = "example-runner-ash", version = "0.0.0", depth = 20 }, - { name = "example-runner-cpu", version = "0.0.0", depth = 20 }, - { name = "example-runner-wgpu", version = "0.0.0", depth = 20 }, - { name = "compiletests", version = "0.0.0", depth = 20 }, - { name = "compiletests-deps-helper", version = "0.0.0", depth = 20 }, + # HACK(eddyb) `jni` (an `android-activity` dep) uses older `windows-*`. + { name = "jni", version = "=0.21.1", depth = 4 }, + # HACK(eddyb) `plist` (an `ash-molten` build dep) uses older `quick-xml`. + { name = "plist", version = "=1.7.0", depth = 2 }, + # HACK(eddyb) `minifb` (an `example-runner-cpu` dep) uses older `wayland-*`. + { name = "minifb", version = "=0.25.0", depth = 3 }, + # HACK(eddyb) `num_cpus` (a `tester` dep) uses older `hermit-abi`. + { name = "num_cpus", version = "=1.16.0", depth = 2 }, + + # FIXME(eddyb) outdated `winit` version uses older `windows-*`, + # requires an upgrade to `winit 0.30` to resolve. + { name = "winit", version = "=0.29.15", depth = 4 }, ] @@ -65,7 +79,7 @@ exceptions = [ # CC0 is a permissive license but somewhat unclear status for source code # so we prefer to not have dependencies using it # https://tldrlegal.com/license/creative-commons-cc0-1.0-universal - { allow = ["CC0-1.0"], name = "notify", version = "5.0.0-pre.13" }, + { allow = ["CC0-1.0"], name = "notify", version = "7.0.0" }, { allow = ["CC0-1.0"], name = "hexf-parse" }, ] diff --git a/examples/runners/ash/Cargo.toml b/examples/runners/ash/Cargo.toml index 014c0c7fc3..13dda5f97d 100644 --- a/examples/runners/ash/Cargo.toml +++ b/examples/runners/ash/Cargo.toml @@ -14,14 +14,14 @@ use-installed-tools = ["spirv-builder/use-installed-tools"] use-compiled-tools = ["spirv-builder/use-compiled-tools"] [dependencies] -ash = "0.37" -ash-window = "0.12" -raw-window-handle = "0.5.1" -winit = { version = "0.29.0", features = ["rwh_05"] } +ash = "0.38" +ash-window = "0.13" +raw-window-handle = "0.6.2" +winit = "0.29.0" clap = { version = "4", features = ["derive"] } cfg-if = "1.0.0" shared = { path = "../../shaders/shared" } spirv-builder = { workspace = true, default-features = false } [target.'cfg(target_os = "macos")'.dependencies] -ash-molten = { version = "0.13.1", features = ["pre-built"] } +ash-molten = { version = "0.20", features = ["pre-built"] } diff --git a/examples/runners/ash/src/main.rs b/examples/runners/ash/src/main.rs index ca92e2a3ad..f35174c05c 100644 --- a/examples/runners/ash/src/main.rs +++ b/examples/runners/ash/src/main.rs @@ -71,13 +71,9 @@ // crate-specific exceptions: // #![allow()] -use ash::{ - extensions::{ext, khr}, - util::read_spv, - vk, -}; +use ash::{ext, khr, util::read_spv, vk}; -use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle}; +use raw_window_handle::{HasDisplayHandle as _, HasWindowHandle as _}; use winit::{ event::{Event, WindowEvent}, event_loop::{ControlFlow, EventLoop}, @@ -277,9 +273,9 @@ pub struct RenderBase { pub instance: ash::Instance, pub device: ash::Device, - pub swapchain_loader: khr::Swapchain, + pub swapchain_loader: khr::swapchain::Device, - pub debug_utils_loader: Option, + pub debug_utils_loader: Option, pub debug_call_back: Option, pub pdevice: vk::PhysicalDevice, @@ -287,7 +283,7 @@ pub struct RenderBase { pub present_queue: vk::Queue, pub surface: vk::SurfaceKHR, - pub surface_loader: khr::Surface, + pub surface_loader: khr::surface::Instance, pub surface_format: vk::SurfaceFormatKHR, } @@ -315,21 +311,21 @@ impl RenderBase { .collect(); let mut extension_names_raw = - ash_window::enumerate_required_extensions(window.raw_display_handle()) + ash_window::enumerate_required_extensions(window.display_handle().unwrap().into()) .unwrap() .to_vec(); if options.debug_layer { - extension_names_raw.push(ext::DebugUtils::name().as_ptr()); + extension_names_raw.push(ext::debug_utils::NAME.as_ptr()); } - let appinfo = vk::ApplicationInfo::builder() + let appinfo = vk::ApplicationInfo::default() .application_name(&app_name) .application_version(0) .engine_name(&app_name) .engine_version(0) .api_version(vk::make_api_version(0, 1, 2, 0)); - let instance_create_info = vk::InstanceCreateInfo::builder() + let instance_create_info = vk::InstanceCreateInfo::default() .application_info(&appinfo) .enabled_layer_names(&layers_names_raw) .enabled_extension_names(&extension_names_raw); @@ -345,17 +341,17 @@ impl RenderBase { ash_window::create_surface( &entry, &instance, - window.raw_display_handle(), - window.raw_window_handle(), + window.display_handle().unwrap().into(), + window.window_handle().unwrap().into(), None, ) .unwrap() }; let (debug_utils_loader, debug_call_back) = if options.debug_layer { - let debug_utils_loader = ext::DebugUtils::new(&entry, &instance); + let debug_utils_loader = ext::debug_utils::Instance::new(&entry, &instance); let debug_call_back = { - let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::builder() + let debug_info = vk::DebugUtilsMessengerCreateInfoEXT::default() .message_severity( vk::DebugUtilsMessageSeverityFlagsEXT::ERROR | vk::DebugUtilsMessageSeverityFlagsEXT::WARNING @@ -380,7 +376,7 @@ impl RenderBase { (None, None) }; - let surface_loader = khr::Surface::new(&entry, &instance); + let surface_loader = khr::surface::Instance::new(&entry, &instance); let (pdevice, queue_family_index) = unsafe { instance @@ -413,25 +409,22 @@ impl RenderBase { let device: ash::Device = { let device_extension_names_raw = [ - khr::Swapchain::name().as_ptr(), - vk::KhrShaderNonSemanticInfoFn::name().as_ptr(), + khr::swapchain::NAME.as_ptr(), + khr::shader_non_semantic_info::NAME.as_ptr(), ]; let features = vk::PhysicalDeviceFeatures { shader_clip_distance: 1, ..Default::default() }; let priorities = [1.0]; - let queue_info = [vk::DeviceQueueCreateInfo::builder() + let queue_info = [vk::DeviceQueueCreateInfo::default() .queue_family_index(queue_family_index) - .queue_priorities(&priorities) - .build()]; + .queue_priorities(&priorities)]; let mut vulkan_memory_model_features = - vk::PhysicalDeviceVulkanMemoryModelFeatures::builder() - .vulkan_memory_model(true) - .build(); + vk::PhysicalDeviceVulkanMemoryModelFeatures::default().vulkan_memory_model(true); - let device_create_info = vk::DeviceCreateInfo::builder() + let device_create_info = vk::DeviceCreateInfo::default() .push_next(&mut vulkan_memory_model_features) .queue_create_infos(&queue_info) .enabled_extension_names(&device_extension_names_raw) @@ -443,7 +436,7 @@ impl RenderBase { } }; - let swapchain_loader = khr::Swapchain::new(&instance, &device); + let swapchain_loader = khr::swapchain::Device::new(&instance, &device); let present_queue = unsafe { device.get_device_queue(queue_family_index, 0) }; @@ -532,7 +525,7 @@ impl RenderBase { .unwrap_or(vk::PresentModeKHR::FIFO) }; let extent = self.surface_resolution(); - let swapchain_create_info = vk::SwapchainCreateInfoKHR::builder() + let swapchain_create_info = vk::SwapchainCreateInfoKHR::default() .surface(self.surface) .min_image_count(desired_image_count) .image_color_space(self.surface_format.color_space) @@ -560,7 +553,7 @@ impl RenderBase { .unwrap() .iter() .map(|&image| { - let create_view_info = vk::ImageViewCreateInfo::builder() + let create_view_info = vk::ImageViewCreateInfo::default() .view_type(vk::ImageViewType::TYPE_2D) .format(self.surface_format.format) .components(vk::ComponentMapping { @@ -598,7 +591,7 @@ impl RenderBase { unsafe { self.device .create_framebuffer( - &vk::FramebufferCreateInfo::builder() + &vk::FramebufferCreateInfo::default() .render_pass(render_pass) .attachments(&framebuffer_attachments) .width(extent.width) @@ -633,11 +626,10 @@ impl RenderBase { dst_stage_mask: vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT, ..Default::default() }]; - let subpasses = [vk::SubpassDescription::builder() + let subpasses = [vk::SubpassDescription::default() .color_attachments(&color_attachment_refs) - .pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS) - .build()]; - let renderpass_create_info = vk::RenderPassCreateInfo::builder() + .pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS)]; + let renderpass_create_info = vk::RenderPassCreateInfo::default() .attachments(&renderpass_attachments) .subpasses(&subpasses) .dependencies(&dependencies); @@ -745,38 +737,37 @@ impl RenderCtx { } pub fn create_pipeline_layout(&self) -> vk::PipelineLayout { - let push_constant_range = vk::PushConstantRange::builder() + let push_constant_range = vk::PushConstantRange::default() .offset(0) .size(std::mem::size_of::() as u32) - .stage_flags(vk::ShaderStageFlags::ALL) - .build(); - let layout_create_info = vk::PipelineLayoutCreateInfo::builder() - .push_constant_ranges(&[push_constant_range]) - .build(); + .stage_flags(vk::ShaderStageFlags::ALL); unsafe { self.base .device - .create_pipeline_layout(&layout_create_info, None) + .create_pipeline_layout( + &vk::PipelineLayoutCreateInfo::default() + .push_constant_ranges(&[push_constant_range]), + None, + ) .unwrap() } } pub fn rebuild_pipelines(&mut self, pipeline_cache: vk::PipelineCache) { // NOTE(eddyb) this acts like an integration test for specialization constants. - let spec_const_entries = [vk::SpecializationMapEntry::builder() + let spec_const_entries = [vk::SpecializationMapEntry::default() .constant_id(0x5007) .offset(0) - .size(4) - .build()]; + .size(4)]; let spec_const_data = u32::to_le_bytes(self.sky_fs_spec_id_0x5007_sun_intensity_extra_spec_const_factor); - let specialization_info = vk::SpecializationInfo::builder() + let specialization_info = vk::SpecializationInfo::default() .map_entries(&spec_const_entries) .data(&spec_const_data); self.cleanup_pipelines(); let pipeline_layout = self.create_pipeline_layout(); - let viewport = vk::PipelineViewportStateCreateInfo::builder() + let viewport = vk::PipelineViewportStateCreateInfo::default() .scissor_count(1) .viewport_count(1); let modules_names = self @@ -805,28 +796,32 @@ impl RenderCtx { module: *frag_module, p_name: (*frag_name).as_ptr(), stage: vk::ShaderStageFlags::FRAGMENT, - p_specialization_info: &*specialization_info, + p_specialization_info: &specialization_info, ..Default::default() }, ])) }) .collect::>(); + let descs_indirect_parts = descs + .iter() + .map(|desc| desc.indirect_parts()) + .collect::>(); let pipeline_info = descs .iter() - .map(|desc| { - vk::GraphicsPipelineCreateInfo::builder() + .zip(&descs_indirect_parts) + .map(|(desc, desc_indirect_parts)| { + vk::GraphicsPipelineCreateInfo::default() .stages(&desc.shader_stages) .vertex_input_state(&desc.vertex_input) .input_assembly_state(&desc.input_assembly) .rasterization_state(&desc.rasterization) .multisample_state(&desc.multisample) .depth_stencil_state(&desc.depth_stencil) - .color_blend_state(&desc.color_blend) - .dynamic_state(&desc.dynamic_state_info) + .color_blend_state(&desc_indirect_parts.color_blend) + .dynamic_state(&desc_indirect_parts.dynamic_state_info) .viewport_state(&viewport) .layout(pipeline_layout) .render_pass(self.render_pass) - .build() }) .collect::>(); self.pipelines = unsafe { @@ -835,13 +830,10 @@ impl RenderCtx { .create_graphics_pipelines(pipeline_cache, &pipeline_info, None) .expect("Unable to create graphics pipeline") } - .iter() - .zip(descs) - .map(|(&pipeline, desc)| Pipeline { + .into_iter() + .map(|pipeline| Pipeline { pipeline, pipeline_layout, - color_blend_attachments: desc.color_blend_attachments, - dynamic_state: desc.dynamic_state, }) .collect(); } @@ -871,7 +863,7 @@ impl RenderCtx { /// old shader module if there was one with the same name already. Does not rebuild pipelines /// that may be using the shader module, nor does it invalidate them. pub fn insert_shader_module(&mut self, name: String, spirv: &[u32]) { - let shader_info = vk::ShaderModuleCreateInfo::builder().code(spirv); + let shader_info = vk::ShaderModuleCreateInfo::default().code(spirv); let shader_module = unsafe { self.base .device @@ -971,7 +963,7 @@ impl RenderCtx { let wait_semaphors = [self.sync.rendering_complete_semaphore]; let swapchains = [self.swapchain]; let image_indices = [present_index]; - let present_info = vk::PresentInfoKHR::builder() + let present_info = vk::PresentInfoKHR::default() .wait_semaphores(&wait_semaphors) .swapchains(&swapchains) .image_indices(&image_indices); @@ -994,15 +986,14 @@ impl RenderCtx { framebuffer: vk::Framebuffer, clear_values: &[vk::ClearValue], ) { - let render_pass_begin_info = vk::RenderPassBeginInfo::builder() + let render_pass_begin_info = vk::RenderPassBeginInfo::default() .render_pass(self.render_pass) .framebuffer(framebuffer) .render_area(vk::Rect2D { offset: vk::Offset2D { x: 0, y: 0 }, extent: self.scissors[0].extent, }) - .clear_values(clear_values) - .build(); + .clear_values(clear_values); self.record_submit_commandbuffer( &[vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT], |device, draw_command_buffer| unsafe { @@ -1075,7 +1066,7 @@ impl RenderCtx { .reset_command_pool(self.commands.pool, vk::CommandPoolResetFlags::empty()) .expect("Reset command pool failed."); - let command_buffer_begin_info = vk::CommandBufferBeginInfo::builder() + let command_buffer_begin_info = vk::CommandBufferBeginInfo::default() .flags(vk::CommandBufferUsageFlags::ONE_TIME_SUBMIT); self.base @@ -1096,7 +1087,7 @@ impl RenderCtx { let command_buffers = vec![self.commands.draw_command_buffer]; let wait_semaphores = &[self.sync.present_complete_semaphore]; let signal_semaphores = &[self.sync.rendering_complete_semaphore]; - let submit_info = vk::SubmitInfo::builder() + let submit_info = vk::SubmitInfo::default() .wait_semaphores(wait_semaphores) .wait_dst_stage_mask(wait_mask) .command_buffers(&command_buffers) @@ -1106,7 +1097,7 @@ impl RenderCtx { .device .queue_submit( self.base.present_queue, - &[submit_info.build()], + &[submit_info], self.sync.draw_commands_reuse_fence, ) .expect("queue submit failed."); @@ -1152,7 +1143,7 @@ pub struct RenderSync { impl RenderSync { pub fn new(base: &RenderBase) -> Self { let fence_create_info = - vk::FenceCreateInfo::builder().flags(vk::FenceCreateFlags::SIGNALED); + vk::FenceCreateInfo::default().flags(vk::FenceCreateFlags::SIGNALED); let semaphore_create_info = vk::SemaphoreCreateInfo::default(); @@ -1188,7 +1179,7 @@ impl RenderCommandPool { pub fn new(base: &RenderBase) -> Self { let pool = { let pool_create_info = - vk::CommandPoolCreateInfo::builder().queue_family_index(base.queue_family_index); + vk::CommandPoolCreateInfo::default().queue_family_index(base.queue_family_index); unsafe { base.device @@ -1198,7 +1189,7 @@ impl RenderCommandPool { }; let command_buffers = { - let command_buffer_allocate_info = vk::CommandBufferAllocateInfo::builder() + let command_buffer_allocate_info = vk::CommandBufferAllocateInfo::default() .command_buffer_count(1) .command_pool(pool) .level(vk::CommandBufferLevel::PRIMARY); @@ -1220,25 +1211,27 @@ impl RenderCommandPool { pub struct Pipeline { pub pipeline: vk::Pipeline, pub pipeline_layout: vk::PipelineLayout, - pub color_blend_attachments: Box<[vk::PipelineColorBlendAttachmentState]>, - pub dynamic_state: Box<[vk::DynamicState]>, } -pub struct PipelineDescriptor { +pub struct PipelineDescriptor<'a> { pub color_blend_attachments: Box<[vk::PipelineColorBlendAttachmentState]>, pub dynamic_state: Box<[vk::DynamicState]>, - pub shader_stages: Box<[vk::PipelineShaderStageCreateInfo]>, - pub vertex_input: vk::PipelineVertexInputStateCreateInfo, - pub input_assembly: vk::PipelineInputAssemblyStateCreateInfo, - pub rasterization: vk::PipelineRasterizationStateCreateInfo, - pub multisample: vk::PipelineMultisampleStateCreateInfo, - pub depth_stencil: vk::PipelineDepthStencilStateCreateInfo, - pub color_blend: vk::PipelineColorBlendStateCreateInfo, - pub dynamic_state_info: vk::PipelineDynamicStateCreateInfo, + pub shader_stages: Box<[vk::PipelineShaderStageCreateInfo<'a>]>, + pub vertex_input: vk::PipelineVertexInputStateCreateInfo<'static>, + pub input_assembly: vk::PipelineInputAssemblyStateCreateInfo<'static>, + pub rasterization: vk::PipelineRasterizationStateCreateInfo<'static>, + pub multisample: vk::PipelineMultisampleStateCreateInfo<'static>, + pub depth_stencil: vk::PipelineDepthStencilStateCreateInfo<'static>, } -impl PipelineDescriptor { - fn new(shader_stages: Box<[vk::PipelineShaderStageCreateInfo]>) -> Self { +// HACK(eddyb) these fields need to borrow from `PipelineDescriptor` itself. +pub struct PipelineDescriptorIndirectParts<'a> { + pub color_blend: vk::PipelineColorBlendStateCreateInfo<'a>, + pub dynamic_state_info: vk::PipelineDynamicStateCreateInfo<'a>, +} + +impl<'a> PipelineDescriptor<'a> { + fn new(shader_stages: Box<[vk::PipelineShaderStageCreateInfo<'a>]>) -> Self { let vertex_input = vk::PipelineVertexInputStateCreateInfo { vertex_attribute_description_count: 0, vertex_binding_description_count: 0, @@ -1288,15 +1281,7 @@ impl PipelineDescriptor { | vk::ColorComponentFlags::B | vk::ColorComponentFlags::A, }]); - let color_blend = vk::PipelineColorBlendStateCreateInfo::builder() - .logic_op(vk::LogicOp::CLEAR) - .attachments(color_blend_attachments.as_ref()) - .build(); - let dynamic_state = Box::new([vk::DynamicState::VIEWPORT, vk::DynamicState::SCISSOR]); - let dynamic_state_info = vk::PipelineDynamicStateCreateInfo::builder() - .dynamic_states(dynamic_state.as_ref()) - .build(); Self { color_blend_attachments, @@ -1307,8 +1292,16 @@ impl PipelineDescriptor { rasterization, multisample, depth_stencil, - color_blend, - dynamic_state_info, + } + } + + fn indirect_parts(&self) -> PipelineDescriptorIndirectParts<'_> { + PipelineDescriptorIndirectParts { + color_blend: vk::PipelineColorBlendStateCreateInfo::default() + .logic_op(vk::LogicOp::CLEAR) + .attachments(&self.color_blend_attachments), + dynamic_state_info: vk::PipelineDynamicStateCreateInfo::default() + .dynamic_states(&self.dynamic_state), } } } @@ -1330,7 +1323,7 @@ unsafe fn any_as_u8_slice(p: &T) -> &[u8] { unsafe extern "system" fn vulkan_debug_callback( message_severity: vk::DebugUtilsMessageSeverityFlagsEXT, message_type: vk::DebugUtilsMessageTypeFlagsEXT, - p_callback_data: *const vk::DebugUtilsMessengerCallbackDataEXT, + p_callback_data: *const vk::DebugUtilsMessengerCallbackDataEXT<'_>, _user_data: *mut std::os::raw::c_void, ) -> vk::Bool32 { let callback_data = *p_callback_data; diff --git a/examples/runners/wgpu/Cargo.toml b/examples/runners/wgpu/Cargo.toml index 0548bbeee5..9bfe8ca21f 100644 --- a/examples/runners/wgpu/Cargo.toml +++ b/examples/runners/wgpu/Cargo.toml @@ -24,7 +24,7 @@ futures = { version = "0.3", default-features = false, features = ["std", "execu wgpu = { version = "22.1", features = ["spirv", "vulkan-portability"] } winit = { version = "0.29.0", features = ["android-native-activity", "rwh_05"] } clap = { version = "4", features = ["derive"] } -strum = { version = "0.25.0", default-features = false, features = ["std", "derive"] } +strum = { version = "0.26.0", default-features = false, features = ["std", "derive"] } bytemuck = "1.6.3" [target.'cfg(not(any(target_os = "android", target_arch = "wasm32")))'.dependencies] @@ -32,7 +32,7 @@ env_logger = "0.11.0" spirv-builder = { workspace = true, features = ["watch"] } [target.'cfg(target_os = "android")'.dependencies] -android_logger = "0.13.0" +android_logger = "0.14.1" # NOTE(eddyb) `winit` feature `android-native-activity` is always enabled above, # to avoid specifying the dependency twice, but only applies to android builds.