From 406f9d7114774b2e33912d8901ac3af2a68ed306 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 3 Feb 2023 15:47:23 -0600 Subject: [PATCH] chore: update dependencies TODO: Text rendering issue with egui v0.20 --- Cargo.lock | 204 +++++++++++++++++++++++++++++++++++++++-------------- Cargo.toml | 8 +-- src/gui.rs | 40 ++++------- 3 files changed, 169 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f9d235..732cc24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,6 +18,15 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330223a1aecc308757b9926e9391c9b47f8ef2dbd8aea9df88312aea18c5e8d6" +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -104,9 +113,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "ash" -version = "0.37.0+1.3.209" +version = "0.37.2+1.3.238" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006ca68e0f2b03f22d6fa9f2860f85aed430d257fec20f8879b2145e7c7ae1a6" +checksum = "28bf19c1f0a470be5fbf7522a308a05df06610252c5bcf5143e1b23f629a9a03" dependencies = [ "libloading", ] @@ -134,6 +143,21 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide 0.6.2", + "object", + "rustc-demangle", +] + [[package]] name = "base-x" version = "0.2.11" @@ -279,12 +303,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - [[package]] name = "clang-sys" version = "1.4.0" @@ -375,6 +393,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "com-rs" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" + [[package]] name = "combine" version = "4.6.6" @@ -479,7 +503,7 @@ dependencies = [ "stdweb", "thiserror", "web-sys", - "windows", + "windows 0.37.0", ] [[package]] @@ -522,9 +546,9 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" [[package]] name = "d3d12" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827914e1f53b1e0e025ecd3d967a7836b7bcb54520f90e21ef8df7b4d88a2759" +checksum = "d8f0de2f5a8e7bd4a9eec0e3c781992a4ce1724f68aec7d7a3715344de8b39da" dependencies = [ "bitflags", "libloading", @@ -629,10 +653,19 @@ dependencies = [ ] [[package]] -name = "egui" -version = "0.19.0" +name = "ecolor" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc9fcd393c3daaaf5909008a1d948319d538b79c51871e4df0993260260a94e4" +checksum = "b601108bca3af7650440ace4ca55b2daf52c36f2635be3587d77b16efd8d0691" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "egui" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65a5e883a316e53866977450eecfbcac9c48109c2ab3394af29feb83fcde4ea9" dependencies = [ "ahash 0.8.1", "epaint", @@ -641,9 +674,9 @@ dependencies = [ [[package]] name = "egui_wgpu_backend" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9a4a022610dec7cb5ccce43d397727d190ca38b7c988dece516d585c96caa6" +checksum = "1c5312739ff1ef26ce3015926576b0fd2d77a82c44fc214cfb1d6b0864da9b41" dependencies = [ "bytemuck", "egui", @@ -652,9 +685,9 @@ dependencies = [ [[package]] name = "egui_winit_platform" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34fb1c870207c14b99fb7ed9a8760fd7be9a0d96b3516ead3a5e3abe7bb88400" +checksum = "abab53ef0d83b78072041671b9d29abc31373c3ef4f674551fe8abd59fc56cea" dependencies = [ "egui", "winit", @@ -662,23 +695,24 @@ dependencies = [ [[package]] name = "emath" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9542a40106fdba943a055f418d1746a050e1a903a049b030c2b097d4686a33cf" +checksum = "5277249c8c3430e7127e4f2c40a77485e7baf11ae132ce9b3253a8ed710df0a0" dependencies = [ "bytemuck", ] [[package]] name = "epaint" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba04741be7f6602b1a1b28f1082cce45948a7032961c52814f8946b28493300" +checksum = "de14b65fe5e423e0058f77a8beb2c863b056d0566d6c4ce0d097aa5814cb705a" dependencies = [ "ab_glyph", "ahash 0.8.1", "atomic_refcell", "bytemuck", + "ecolor", "emath", "nohash-hasher", "parking_lot", @@ -821,9 +855,9 @@ dependencies = [ [[package]] name = "gilrs" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ba7c37bf8ea7ba0c3e3795dfa1a7771b1e47c4bb417c4d27c7b338d79685f" +checksum = "7d0342acdc7b591d171212e17c9350ca02383b86d5f9af33c6e3598e03a6c57e" dependencies = [ "fnv", "gilrs-core", @@ -834,9 +868,9 @@ dependencies = [ [[package]] name = "gilrs-core" -version = "0.4.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a8d94a7fc5afd27e894e08a4cfe5a49237f85bcc7140e90721bad3399c7d02" +checksum = "6789d356476c3280a4e15365d23f62b4b4f1bcdac81fdd552f65807bce4666dd" dependencies = [ "core-foundation", "io-kit-sys", @@ -844,15 +878,20 @@ dependencies = [ "libc", "libudev-sys", "log", - "nix 0.24.2", - "rusty-xinput", + "nix 0.25.0", "uuid", "vec_map", "wasm-bindgen", "web-sys", - "winapi", + "windows 0.43.0", ] +[[package]] +name = "gimli" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec" + [[package]] name = "glob" version = "0.3.0" @@ -861,9 +900,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "glow" -version = "0.11.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" +checksum = "8edf6019dff2d92ad27c1e3ff82ad50a0aea5b01370353cc928bfdc33e95925c" dependencies = [ "js-sys", "slotmap", @@ -890,6 +929,19 @@ dependencies = [ "bitflags", ] +[[package]] +name = "gpu-allocator" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434618454f74b63f9b39328298097256977c41ea0ba9d75a47238b77790b6163" +dependencies = [ + "backtrace", + "log", + "thiserror", + "winapi", + "windows 0.43.0", +] + [[package]] name = "gpu-descriptor" version = "0.2.3" @@ -919,6 +971,21 @@ dependencies = [ "ahash 0.7.6", ] +[[package]] +name = "hassle-rs" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90601c6189668c7345fc53842cb3f3a3d872203d523be1b3cb44a36a3e62fb85" +dependencies = [ + "bitflags", + "com-rs", + "libc", + "libloading", + "thiserror", + "widestring", + "winapi", +] + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1224,9 +1291,9 @@ dependencies = [ [[package]] name = "naga" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262d2840e72dbe250e8cf2f522d080988dfca624c4112c096238a4845f591707" +checksum = "5eafe22a23b797c9bc227c6c896419b26b5bb88fa903417a3adaed08778850d5" dependencies = [ "bit-set", "bitflags", @@ -1447,6 +1514,15 @@ dependencies = [ "cc", ] +[[package]] +name = "object" +version = "0.30.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +dependencies = [ + "memchr", +] + [[package]] name = "oboe" version = "0.4.6" @@ -1708,6 +1784,12 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -1723,17 +1805,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rusty-xinput" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2aa654bc32eb9ca14cce1a084abc9dfe43949a4547c35269a094c39272db3bb" -dependencies = [ - "lazy_static", - "log", - "winapi", -] - [[package]] name = "ryu" version = "1.0.11" @@ -2368,15 +2439,17 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2272b17bffc8a0c7d53897435da7c1db587c87d3a14e8dae9cdb8d1d210fc0f" +checksum = "d14c6bfcf3b10f4273f522a95994553c0a5f2934976e62e61a720ae4bc2eb8f2" dependencies = [ "arrayvec 0.7.2", + "cfg-if", "js-sys", "log", "naga", "parking_lot", + "profiling", "raw-window-handle 0.5.0", "smallvec", "static_assertions", @@ -2390,14 +2463,13 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d14cad393054caf992ee02b7da6a372245d39a484f7461c1f44f6f6359bd28" +checksum = "be1f61be28e557a6ecb2506cac06c63fae3b6d302a006f38195a7a80995abeb9" dependencies = [ "arrayvec 0.7.2", "bit-vec", "bitflags", - "cfg_aliases", "codespan-reporting", "fxhash", "log", @@ -2414,9 +2486,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.14.1" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc320a61acb26be4f549c9b1b53405c10a223fbfea363ec39474c32c348d12f" +checksum = "82e95792925fe3d58950b9a5c2a191caa145e2bc570e2d233f0d7320f6a8e814" dependencies = [ "android_system_properties", "arrayvec 0.7.2", @@ -2430,9 +2502,12 @@ dependencies = [ "fxhash", "glow", "gpu-alloc", + "gpu-allocator", "gpu-descriptor", + "hassle-rs", "js-sys", "khronos-egl", + "libc", "libloading", "log", "metal", @@ -2453,13 +2528,21 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.14.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb6b28ef22cac17b9109b25b3bf8c9a103eeb293d7c5f78653979b09140375f6" +checksum = "ecf8cfcbf98f94cc8bd5981544c687140cf9d3948e2ab83849367ead2cd737cf" dependencies = [ "bitflags", + "js-sys", + "web-sys", ] +[[package]] +name = "widestring" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" + [[package]] name = "winapi" version = "0.3.9" @@ -2504,6 +2587,21 @@ dependencies = [ "windows_x86_64_msvc 0.37.0", ] +[[package]] +name = "windows" +version = "0.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + [[package]] name = "windows-sys" version = "0.36.1" diff --git a/Cargo.toml b/Cargo.toml index 8db5584..6d05615 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,10 +12,10 @@ bitfield = "0.14" clap = { version = "4.0", features = ["cargo"] } gilrs = "0.10" winit = "0.27" -egui = "0.19" -wgpu = "0.14" -egui_wgpu_backend = "0.20" -egui_winit_platform = "0.16" +egui = "0.20" +wgpu = "0.15" +egui_wgpu_backend = "0.21" +egui_winit_platform = "0.17" pollster = "0.2" rodio = "0.16" rtrb = "0.2" diff --git a/src/gui.rs b/src/gui.rs index 8e83789..9535bfa 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -2,9 +2,9 @@ use egui::{Context, TextureId}; use egui_wgpu_backend::{RenderPass, ScreenDescriptor}; use egui_winit_platform::Platform; use wgpu::{ - Adapter, Backends, Color, CommandEncoder, CompositeAlphaMode, Device, Extent3d, FilterMode, - Instance, Queue, RequestDeviceError, Surface, SurfaceConfiguration, Texture, TextureFormat, - TextureUsages, TextureView, TextureViewDescriptor, + Adapter, Color, CommandEncoder, Device, Extent3d, FilterMode, Instance, Queue, + RequestDeviceError, Surface, SurfaceConfiguration, Texture, TextureFormat, TextureUsages, + TextureView, TextureViewDescriptor, }; use winit::dpi::PhysicalSize; use winit::error::OsError; @@ -44,15 +44,20 @@ impl Gui { pub fn new(title: String, event_loop: &EventLoop, cpu: &Cpu) -> Self { let window = build_window(event_loop).expect("build window"); - let instance = Instance::new(Backends::PRIMARY); - let surface = unsafe { instance.create_surface(&window) }; + let instance = Instance::new(Default::default()); + let surface = unsafe { instance.create_surface(&window).expect("create surface") }; let adapter = request_adapter(&instance, &surface).expect("request adaptor"); let (device, queue) = request_device(&adapter).expect("request device"); - let texture_format = surface.get_supported_formats(&adapter)[0]; // First is preferred - let alpha_mode = surface.get_supported_alpha_modes(&adapter)[0]; - let surface_config = surface_config(&window, alpha_mode, texture_format); + let caps = surface.get_capabilities(&adapter); + let texture_format = caps.formats[0]; + + let win_size = window.inner_size(); + let surface_config = surface + .get_default_config(&adapter, win_size.width, win_size.height) + .expect("have surface supported by adapter"); + surface.configure(&device, &surface_config); let platform = platform(&window); let mut render_pass = RenderPass::new(&device, texture_format, 1); @@ -350,24 +355,6 @@ fn request_device(adapter: &Adapter) -> Result<(Device, Queue), RequestDeviceErr )) } -fn surface_config( - window: &Window, - alpha_mode: CompositeAlphaMode, - format: TextureFormat, -) -> SurfaceConfiguration { - use wgpu::PresentMode; - - let size = window.inner_size(); - SurfaceConfiguration { - usage: TextureUsages::RENDER_ATTACHMENT, - format, - width: size.width as u32, - height: size.height as u32, - present_mode: PresentMode::Fifo, - alpha_mode, - } -} - fn platform(window: &Window) -> Platform { use egui::FontDefinitions; use egui_winit_platform::PlatformDescriptor; @@ -401,6 +388,7 @@ fn create_texture(device: &Device, size: Extent3d) -> Texture { format: TextureFormat::Rgba8UnormSrgb, usage: TextureUsages::COPY_DST | TextureUsages::TEXTURE_BINDING, label: Some("gb_pixel_buffer"), + view_formats: &[TextureFormat::Rgba8UnormSrgb], }) }