From c6c077398ef73ad6111e588d638e70327be01bb7 Mon Sep 17 00:00:00 2001 From: Paris DOUADY Date: Fri, 19 Jan 2024 21:06:20 +0100 Subject: [PATCH] update to wgpu 0.19 --- Cargo.lock | 193 +++++++++++++++++----------------------- Cargo.toml | 6 +- engine/Cargo.toml | 6 +- engine/src/framework.rs | 8 +- engine/src/gfx.rs | 13 +-- 5 files changed, 101 insertions(+), 125 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1732f271..8823ee2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -499,10 +499,35 @@ dependencies = [ ] [[package]] -name = "com-rs" -version = "0.2.1" +name = "com" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" +checksum = "7e17887fd17353b65b1b2ef1c526c83e26cd72e74f598a8dc1bee13a48f3d9f6" +dependencies = [ + "com_macros", +] + +[[package]] +name = "com_macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d375883580a668c7481ea6631fc1a8863e33cc335bf56bfad8d7e6d4b04b13a5" +dependencies = [ + "com_macros_support", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "com_macros_support" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "combine" @@ -673,9 +698,9 @@ checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" [[package]] name = "d3d12" -version = "0.7.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20" +checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" dependencies = [ "bitflags 2.4.2", "libloading 0.8.1", @@ -787,8 +812,7 @@ checksum = "0fe5e0c7c863ab37184b6310b4ff6b857c71814ff38e93c5b99fbda1467a5a32" [[package]] name = "ecolor" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57539aabcdbb733b6806ef421b66dec158dc1582107ad6d51913db3600303354" +source = "git+https://github.com/emilk/egui#d319489479c371b15e6419d470551dae5d647396" dependencies = [ "bytemuck", "serde", @@ -797,8 +821,7 @@ dependencies = [ [[package]] name = "egui" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0bf640ed7f3bf3d14ebf00d73bacc09c886443ee84ca6494bde37953012c9e3" +source = "git+https://github.com/emilk/egui#d319489479c371b15e6419d470551dae5d647396" dependencies = [ "accesskit", "ahash", @@ -830,8 +853,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c38c12e04316687dd1b74f3dfe83a885214dfe7f356118a2d3bee2b39740813" +source = "git+https://github.com/emilk/egui#d319489479c371b15e6419d470551dae5d647396" dependencies = [ "bytemuck", "egui", @@ -845,12 +867,11 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d95d9762056c541bd2724de02910d8bccf3af8e37689dc114b21730e64f80a0" +source = "git+https://github.com/emilk/egui#d319489479c371b15e6419d470551dae5d647396" dependencies = [ "egui", "log", - "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "web-time", "winit", ] @@ -858,8 +879,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "753c36d3e2f7a32425af5290af2e52efb3471ea3a263b87f003b5433351b0fd7" +source = "git+https://github.com/emilk/egui#d319489479c371b15e6419d470551dae5d647396" dependencies = [ "egui", "enum-map", @@ -871,8 +891,7 @@ dependencies = [ [[package]] name = "egui_plot" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a159fffebf052f79d1fd26d48e68906a21fec2fce808f7c0a982ec14ed506be" +source = "git+https://github.com/emilk/egui#d319489479c371b15e6419d470551dae5d647396" dependencies = [ "egui", ] @@ -886,8 +905,7 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "emath" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ee58355767587db7ba3738930d93cad3052cd834c2b48b9ef6ef26fe4823b7e" +source = "git+https://github.com/emilk/egui#d319489479c371b15e6419d470551dae5d647396" dependencies = [ "bytemuck", "serde", @@ -984,8 +1002,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e638cb066bff0903bbb6143116cfd134a42279c7d68f19c0352a94f15a402de7" +source = "git+https://github.com/emilk/egui#d319489479c371b15e6419d470551dae5d647396" dependencies = [ "ab_glyph", "ahash", @@ -1074,18 +1091,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "flume" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" -dependencies = [ - "futures-core", - "futures-sink", - "nanorand", - "spin", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1129,18 +1134,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - [[package]] name = "generator" version = "0.7.5" @@ -1183,10 +1176,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -1314,16 +1305,15 @@ dependencies = [ [[package]] name = "gpu-allocator" -version = "0.23.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40fe17c8a05d60c38c0a4e5a3c802f2f1ceb66b76c67d96ffb34bef0475a7fad" +checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884" dependencies = [ - "backtrace", "log", "presser", "thiserror", "winapi", - "windows 0.51.1", + "windows 0.52.0", ] [[package]] @@ -1367,14 +1357,14 @@ dependencies = [ [[package]] name = "hassle-rs" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0" +checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" dependencies = [ - "bitflags 1.3.2", - "com-rs", + "bitflags 2.4.2", + "com", "libc", - "libloading 0.7.4", + "libloading 0.8.1", "thiserror", "widestring", "winapi", @@ -1872,9 +1862,9 @@ dependencies = [ [[package]] name = "naga" -version = "0.14.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae585df4b6514cf8842ac0f1ab4992edc975892704835b549cf818dc0191249e" +checksum = "8878eb410fc90853da3908aebfe61d73d26d4437ef850b70050461f939509899" dependencies = [ "bit-set", "bitflags 2.4.2", @@ -1890,15 +1880,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "nanorand" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" -dependencies = [ - "getrandom", -] - [[package]] name = "nanoserde" version = "0.1.35" @@ -1967,7 +1948,6 @@ dependencies = [ "log", "ndk-sys 0.5.0+25.2.9519653", "num_enum 0.7.2", - "raw-window-handle 0.5.2", "raw-window-handle 0.6.0", "thiserror", ] @@ -2889,9 +2869,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.12.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smithay-client-toolkit" @@ -2936,23 +2916,13 @@ dependencies = [ "serde", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - [[package]] name = "spirv" -version = "0.2.0+1.5.4" +version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" +checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 1.3.2", - "num-traits", + "bitflags 2.4.2", ] [[package]] @@ -3539,9 +3509,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -3559,19 +3529,19 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e7d227c9f961f2061c26f4cb0fbd4df0ef37e056edd0931783599d6c94ef24" +checksum = "d0b71d2ded29e2161db50ab731d6cb42c037bd7ab94864a98fa66ff36b4721a8" dependencies = [ "arrayvec", "cfg-if", - "flume", + "cfg_aliases", "js-sys", "log", "naga", "parking_lot", "profiling", - "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "smallvec", "static_assertions", "wasm-bindgen", @@ -3584,19 +3554,22 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef91c1d62d1e9e81c79e600131a258edf75c9531cbdbde09c44a011a47312726" +checksum = "6b15e451d4060ada0d99a64df44e4d590213496da7c4f245572d51071e8e30ed" dependencies = [ "arrayvec", "bit-vec", "bitflags 2.4.2", + "cfg_aliases", "codespan-reporting", + "indexmap", "log", "naga", + "once_cell", "parking_lot", "profiling", - "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "rustc-hash", "smallvec", "thiserror", @@ -3607,9 +3580,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84ecc802da3eb67b4cf3dd9ea6fe45bbb47ef13e6c49c5c3240868a9cc6cdd9" +checksum = "11f259ceb56727fb097da108d92f8a5cbdb5b74a77f9e396bd43626f67299d61" dependencies = [ "android_system_properties", "arrayvec", @@ -3617,6 +3590,7 @@ dependencies = [ "bit-set", "bitflags 2.4.2", "block", + "cfg_aliases", "core-graphics-types", "d3d12", "glow", @@ -3637,7 +3611,7 @@ dependencies = [ "parking_lot", "profiling", "range-alloc", - "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "renderdoc-sys", "rustc-hash", "smallvec", @@ -3650,9 +3624,9 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d5ed5f0edf0de351fe311c53304986315ce866f394a2e6df0c4b3c70774bcdd" +checksum = "895fcbeb772bfb049eb80b2d6e47f6c9af235284e9703c96fc0218a42ffd5af2" dependencies = [ "bitflags 2.4.2", "js-sys", @@ -3716,21 +3690,21 @@ dependencies = [ [[package]] name = "windows" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -3958,7 +3932,6 @@ dependencies = [ "once_cell", "orbclient", "percent-encoding", - "raw-window-handle 0.5.2", "raw-window-handle 0.6.0", "redox_syscall 0.3.5", "rustix", @@ -4055,7 +4028,7 @@ checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" [[package]] name = "yakui" version = "0.2.0" -source = "git+https://github.com/SecondHalfGames/yakui#2dffdfef0150e87a1773e319f73a85d5f8e9de9b" +source = "git+https://github.com/SecondHalfGames/yakui#7750ad6e1561e29956048c2d7dc4cced1c2ab26f" dependencies = [ "yakui-core", "yakui-widgets", @@ -4064,7 +4037,7 @@ dependencies = [ [[package]] name = "yakui-core" version = "0.2.0" -source = "git+https://github.com/SecondHalfGames/yakui#2dffdfef0150e87a1773e319f73a85d5f8e9de9b" +source = "git+https://github.com/SecondHalfGames/yakui#7750ad6e1561e29956048c2d7dc4cced1c2ab26f" dependencies = [ "anymap", "bitflags 1.3.2", @@ -4080,7 +4053,7 @@ dependencies = [ [[package]] name = "yakui-wgpu" version = "0.2.0" -source = "git+https://github.com/SecondHalfGames/yakui#2dffdfef0150e87a1773e319f73a85d5f8e9de9b" +source = "git+https://github.com/SecondHalfGames/yakui#7750ad6e1561e29956048c2d7dc4cced1c2ab26f" dependencies = [ "bytemuck", "glam", @@ -4093,7 +4066,7 @@ dependencies = [ [[package]] name = "yakui-widgets" version = "0.2.0" -source = "git+https://github.com/SecondHalfGames/yakui#2dffdfef0150e87a1773e319f73a85d5f8e9de9b" +source = "git+https://github.com/SecondHalfGames/yakui#7750ad6e1561e29956048c2d7dc4cced1c2ab26f" dependencies = [ "fontdue", "smol_str 0.1.24", @@ -4104,7 +4077,7 @@ dependencies = [ [[package]] name = "yakui-winit" version = "0.2.0" -source = "git+https://github.com/SecondHalfGames/yakui#2dffdfef0150e87a1773e319f73a85d5f8e9de9b" +source = "git+https://github.com/SecondHalfGames/yakui#7750ad6e1561e29956048c2d7dc4cced1c2ab26f" dependencies = [ "winit", "yakui-core", diff --git a/Cargo.toml b/Cargo.toml index c8e3bd4b..b35aa224 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,10 +19,10 @@ resolver = "2" default-members = ["native_app"] [workspace.dependencies] -egui = "0.25.0" +egui = { git = "https://github.com/emilk/egui" } flat_spatial = "0.6" -egui_extras = "0.25.0" -egui_plot = "0.25.0" +egui_extras = { git = "https://github.com/emilk/egui" } +egui_plot = { git = "https://github.com/emilk/egui" } ordered-float = { version = "4.2.0", default-features = false } oddio = "0.7.4" derive_more = "0.99.17" diff --git a/engine/Cargo.toml b/engine/Cargo.toml index fbc6bc50..64cc2d56 100644 --- a/engine/Cargo.toml +++ b/engine/Cargo.toml @@ -13,10 +13,10 @@ ordered-float = { workspace = true } egui = { workspace = true } oddio = { workspace = true } derive_more = { workspace = true } -wgpu = { version = "0.18.0", default-features = false, features=["wgsl"] } +wgpu = { version = "0.19.0", default-features = false, features=["wgsl"] } winit = { version = "0.29.4" } smol_str = { version = "0.2.0", features = ["serde"] } -egui-winit = { version = "0.25.0", default-features = false } +egui-winit = { git = "https://github.com/emilk/egui" , default-features = false } bytemuck = "1.7.2" image = { version = "0.24.3", default-features = false, features = ["png"] } log = "0.4.11" @@ -27,7 +27,7 @@ rayon = "1.6" beul = "1.0.0" slotmapd = "1.0" inline_tweak = "1.0.8" -egui-wgpu = "0.25.0" +egui-wgpu = { git = "https://github.com/emilk/egui" } cpal = "0.15.0" lewton = "0.10.2" serde = { version = "1.0.183", features = ["derive"] } diff --git a/engine/src/framework.rs b/engine/src/framework.rs index 93c5cd4b..e19b153d 100644 --- a/engine/src/framework.rs +++ b/engine/src/framework.rs @@ -1,6 +1,7 @@ use crate::egui::EguiWrapper; use crate::{get_cursor_icon, AudioContext, FrameContext, GfxContext, InputContext}; use std::mem::ManuallyDrop; +use std::sync::Arc; use std::time::Instant; use winit::dpi::PhysicalSize; use winit::window::Window; @@ -36,7 +37,7 @@ pub trait State: 'static { fn render_yakui(&mut self) {} } -async fn run(el: EventLoop<()>, window: Window) { +async fn run(el: EventLoop<()>, window: Arc) { let mut ctx = Context::new(window, &el).await; let mut state = S::new(&mut ctx); ctx.gfx.defines_changed = false; @@ -199,7 +200,7 @@ pub fn start() { .ok() }) .expect("Failed to append canvas to body"); - wasm_bindgen_futures::spawn_local(run(el, window)); + wasm_bindgen_futures::spawn_local(run(el, Arc::new(window))); } #[cfg(not(target_arch = "wasm32"))] { @@ -230,6 +231,7 @@ pub fn start() { .with_title(format!("Egregoria {}", include_str!("../../VERSION"))) .build(&el) .expect("Failed to create window"); + let window = Arc::new(window); beul::execute(run::(el, window)) } } @@ -249,7 +251,7 @@ pub struct Context { } impl Context { - pub async fn new(window: Window, el: &EventLoop<()>) -> Self { + pub async fn new(window: Arc, el: &EventLoop<()>) -> Self { let gfx = GfxContext::new(window).await; let input = InputContext::default(); let audio = AudioContext::new(); diff --git a/engine/src/gfx.rs b/engine/src/gfx.rs index 8a5e0997..78215a92 100644 --- a/engine/src/gfx.rs +++ b/engine/src/gfx.rs @@ -36,8 +36,8 @@ pub struct FBOs { } pub struct GfxContext { - pub window: Window, - pub surface: Surface, + pub window: Arc, + pub surface: Surface<'static>, pub device: Device, pub queue: Queue, pub fbos: FBOs, @@ -238,7 +238,7 @@ impl<'a> FrameContext<'a> { } impl GfxContext { - pub async fn new(window: Window) -> Self { + pub async fn new(window: Arc) -> Self { let mut backends = backend_bits_from_env().unwrap_or_else(Backends::all); if std::env::var("RENDERDOC").is_ok() { backends = Backends::VULKAN; @@ -251,7 +251,7 @@ impl GfxContext { gles_minor_version: wgpu::Gles3MinorVersion::Automatic, }); - let surface = unsafe { instance.create_surface(&window).unwrap() }; + let surface = instance.create_surface(window.clone()).unwrap(); let adapter = instance .request_adapter(&wgpu::RequestAdapterOptions { power_preference: wgpu::PowerPreference::HighPerformance, @@ -267,8 +267,8 @@ impl GfxContext { .request_device( &wgpu::DeviceDescriptor { label: None, - features: wgpu::Features::empty(), - limits: limit, + required_features: wgpu::Features::empty(), + required_limits: limit, }, None, ) @@ -293,6 +293,7 @@ impl GfxContext { width: win_width, height: win_height, present_mode: wgpu::PresentMode::Fifo, + desired_maximum_frame_latency: 2, alpha_mode: CompositeAlphaMode::Auto, view_formats: vec![], };