From 501f0d2e56c90e7af8e281fd897a5939d7c5a730 Mon Sep 17 00:00:00 2001 From: PolyMeilex Date: Tue, 5 Dec 2023 20:15:50 +0100 Subject: [PATCH 1/2] Texture format update --- Cargo.lock | 91 +++++++++++++------------------------------ neothesia/Cargo.toml | 12 +++--- neothesia/src/main.rs | 1 + 3 files changed, 35 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b6f9bc8..f263e010 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1239,17 +1239,6 @@ dependencies = [ "wgpu", ] -[[package]] -name = "glyphon" -version = "0.3.0" -source = "git+https://github.com/hecrj/glyphon.git?rev=2caa9fc5e5923c1d827d177c3619cab7e9885b85#2caa9fc5e5923c1d827d177c3619cab7e9885b85" -dependencies = [ - "cosmic-text", - "etagere", - "lru", - "wgpu", -] - [[package]] name = "gobject-sys" version = "0.16.3" @@ -1404,7 +1393,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iced_core" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=86b877517feb15b2155c6cfef29246a3f281c8ae#86b877517feb15b2155c6cfef29246a3f281c8ae" +source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" dependencies = [ "bitflags 1.3.2", "instant", @@ -1412,13 +1401,13 @@ dependencies = [ "num-traits", "palette", "thiserror", - "twox-hash", + "xxhash-rust", ] [[package]] name = "iced_futures" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=86b877517feb15b2155c6cfef29246a3f281c8ae#86b877517feb15b2155c6cfef29246a3f281c8ae" +source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" dependencies = [ "futures", "iced_core", @@ -1430,7 +1419,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=86b877517feb15b2155c6cfef29246a3f281c8ae#86b877517feb15b2155c6cfef29246a3f281c8ae" +source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -1441,16 +1430,18 @@ dependencies = [ "image", "kamadak-exif", "log", + "once_cell", "raw-window-handle", "rustc-hash", "thiserror", - "twox-hash", + "unicode-segmentation", + "xxhash-rust", ] [[package]] name = "iced_renderer" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=86b877517feb15b2155c6cfef29246a3f281c8ae#86b877517feb15b2155c6cfef29246a3f281c8ae" +source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -1463,7 +1454,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=86b877517feb15b2155c6cfef29246a3f281c8ae#86b877517feb15b2155c6cfef29246a3f281c8ae" +source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" dependencies = [ "iced_core", "iced_futures", @@ -1473,7 +1464,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=86b877517feb15b2155c6cfef29246a3f281c8ae#86b877517feb15b2155c6cfef29246a3f281c8ae" +source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" dependencies = [ "iced_core", "once_cell", @@ -1483,7 +1474,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=86b877517feb15b2155c6cfef29246a3f281c8ae#86b877517feb15b2155c6cfef29246a3f281c8ae" +source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" dependencies = [ "bytemuck", "cosmic-text", @@ -1493,20 +1484,20 @@ dependencies = [ "raw-window-handle", "rustc-hash", "softbuffer", - "tiny-skia 0.10.0", - "twox-hash", + "tiny-skia 0.11.3", + "xxhash-rust", ] [[package]] name = "iced_wgpu" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=86b877517feb15b2155c6cfef29246a3f281c8ae#86b877517feb15b2155c6cfef29246a3f281c8ae" +source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" dependencies = [ "bitflags 1.3.2", "bytemuck", "futures", "glam", - "glyphon 0.3.0 (git+https://github.com/hecrj/glyphon.git?rev=2caa9fc5e5923c1d827d177c3619cab7e9885b85)", + "glyphon", "guillotiere", "iced_graphics", "log", @@ -1518,7 +1509,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=86b877517feb15b2155c6cfef29246a3f281c8ae#86b877517feb15b2155c6cfef29246a3f281c8ae" +source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" dependencies = [ "iced_renderer", "iced_runtime", @@ -2057,7 +2048,7 @@ name = "neothesia-core" version = "0.1.0" dependencies = [ "bytemuck", - "glyphon 0.3.0 (git+https://github.com/grovesNL/glyphon.git?rev=2caa9fc5e5923c1d827d177c3619cab7e9885b85)", + "glyphon", "log", "midi-file", "objc", @@ -2614,12 +2605,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - [[package]] name = "presser" version = "0.3.1" @@ -2684,18 +2669,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", "rand_core", ] @@ -2704,9 +2677,6 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] [[package]] name = "range-alloc" @@ -3246,9 +3216,9 @@ dependencies = [ [[package]] name = "tiny-skia" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db11798945fa5c3e5490c794ccca7c6de86d3afdd54b4eb324109939c6f37bc" +checksum = "b6a067b809476893fce6a254cf285850ff69c847e6cfbade6a20b655b6c7e80d" dependencies = [ "arrayref", "arrayvec", @@ -3256,7 +3226,7 @@ dependencies = [ "cfg-if", "log", "png", - "tiny-skia-path 0.10.0", + "tiny-skia-path 0.11.3", ] [[package]] @@ -3272,9 +3242,9 @@ dependencies = [ [[package]] name = "tiny-skia-path" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f60aa35c89ac2687ace1a2556eaaea68e8c0d47408a2e3e7f5c98a489e7281c" +checksum = "5de35e8a90052baaaf61f171680ac2f8e925a1e43ea9d2e3a00514772250e541" dependencies = [ "arrayref", "bytemuck", @@ -3353,17 +3323,6 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "rand", - "static_assertions", -] - [[package]] name = "unicode-bidi" version = "0.3.13" @@ -4199,6 +4158,12 @@ version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" +[[package]] +name = "xxhash-rust" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" + [[package]] name = "yazi" version = "0.1.6" diff --git a/neothesia/Cargo.toml b/neothesia/Cargo.toml index bff086da..002c37bf 100644 --- a/neothesia/Cargo.toml +++ b/neothesia/Cargo.toml @@ -38,12 +38,12 @@ oxisynth = { version = "0.0.3", optional = true } midi-file = { workspace = true } midi-io = { path = "../midi-io" } -iced_style = {git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae"} -iced_graphics = {git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae"} -iced_core = {git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae"} -iced_runtime = {git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae"} -iced_wgpu = { git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae", features = ["image"] } -iced_widget = { git = "https://github.com/iced-rs/iced.git", rev="86b877517feb15b2155c6cfef29246a3f281c8ae", features = ["image"] } +iced_style = {git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117"} +iced_graphics = {git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117"} +iced_core = {git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117"} +iced_runtime = {git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117"} +iced_wgpu = { git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117", features = ["image"] } +iced_widget = { git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117", features = ["image"] } [[bin]] name = "neothesia" diff --git a/neothesia/src/main.rs b/neothesia/src/main.rs index 660d571d..4d4bb298 100644 --- a/neothesia/src/main.rs +++ b/neothesia/src/main.rs @@ -202,6 +202,7 @@ impl Neothesia { &self.target.gpu.queue, &mut self.target.gpu.encoder, None, + self.target.gpu.texture_format, view, primitive, &self.target.iced_manager.viewport, From 0c1213ab6da4e9eea3b82455a2b2d1b87fc45292 Mon Sep 17 00:00:00 2001 From: PolyMeilex Date: Tue, 5 Dec 2023 20:21:25 +0100 Subject: [PATCH 2/2] Multi window update --- Cargo.lock | 19 ++++---- neothesia/Cargo.toml | 12 ++--- neothesia/src/iced_utils/iced_conversion.rs | 49 +++++++++++++-------- 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f263e010..71e550a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1393,13 +1393,14 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iced_core" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" +source = "git+https://github.com/iced-rs/iced.git?rev=fc285d3e461626408c56bbc1605fcf0c974b2f69#fc285d3e461626408c56bbc1605fcf0c974b2f69" dependencies = [ "bitflags 1.3.2", "instant", "log", "num-traits", "palette", + "raw-window-handle", "thiserror", "xxhash-rust", ] @@ -1407,7 +1408,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" +source = "git+https://github.com/iced-rs/iced.git?rev=fc285d3e461626408c56bbc1605fcf0c974b2f69#fc285d3e461626408c56bbc1605fcf0c974b2f69" dependencies = [ "futures", "iced_core", @@ -1419,7 +1420,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" +source = "git+https://github.com/iced-rs/iced.git?rev=fc285d3e461626408c56bbc1605fcf0c974b2f69#fc285d3e461626408c56bbc1605fcf0c974b2f69" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -1441,7 +1442,7 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" +source = "git+https://github.com/iced-rs/iced.git?rev=fc285d3e461626408c56bbc1605fcf0c974b2f69#fc285d3e461626408c56bbc1605fcf0c974b2f69" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -1454,7 +1455,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" +source = "git+https://github.com/iced-rs/iced.git?rev=fc285d3e461626408c56bbc1605fcf0c974b2f69#fc285d3e461626408c56bbc1605fcf0c974b2f69" dependencies = [ "iced_core", "iced_futures", @@ -1464,7 +1465,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" +source = "git+https://github.com/iced-rs/iced.git?rev=fc285d3e461626408c56bbc1605fcf0c974b2f69#fc285d3e461626408c56bbc1605fcf0c974b2f69" dependencies = [ "iced_core", "once_cell", @@ -1474,7 +1475,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" +source = "git+https://github.com/iced-rs/iced.git?rev=fc285d3e461626408c56bbc1605fcf0c974b2f69#fc285d3e461626408c56bbc1605fcf0c974b2f69" dependencies = [ "bytemuck", "cosmic-text", @@ -1491,7 +1492,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" +source = "git+https://github.com/iced-rs/iced.git?rev=fc285d3e461626408c56bbc1605fcf0c974b2f69#fc285d3e461626408c56bbc1605fcf0c974b2f69" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -1509,7 +1510,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.12.0" -source = "git+https://github.com/iced-rs/iced.git?rev=8727b3fc50ec251d9c117c51ca1289be5ba9b117#8727b3fc50ec251d9c117c51ca1289be5ba9b117" +source = "git+https://github.com/iced-rs/iced.git?rev=fc285d3e461626408c56bbc1605fcf0c974b2f69#fc285d3e461626408c56bbc1605fcf0c974b2f69" dependencies = [ "iced_renderer", "iced_runtime", diff --git a/neothesia/Cargo.toml b/neothesia/Cargo.toml index 002c37bf..26fc2327 100644 --- a/neothesia/Cargo.toml +++ b/neothesia/Cargo.toml @@ -38,12 +38,12 @@ oxisynth = { version = "0.0.3", optional = true } midi-file = { workspace = true } midi-io = { path = "../midi-io" } -iced_style = {git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117"} -iced_graphics = {git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117"} -iced_core = {git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117"} -iced_runtime = {git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117"} -iced_wgpu = { git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117", features = ["image"] } -iced_widget = { git = "https://github.com/iced-rs/iced.git", rev="8727b3fc50ec251d9c117c51ca1289be5ba9b117", features = ["image"] } +iced_style = {git = "https://github.com/iced-rs/iced.git", rev="fc285d3e461626408c56bbc1605fcf0c974b2f69"} +iced_graphics = {git = "https://github.com/iced-rs/iced.git", rev="fc285d3e461626408c56bbc1605fcf0c974b2f69"} +iced_core = {git = "https://github.com/iced-rs/iced.git", rev="fc285d3e461626408c56bbc1605fcf0c974b2f69"} +iced_runtime = {git = "https://github.com/iced-rs/iced.git", rev="fc285d3e461626408c56bbc1605fcf0c974b2f69"} +iced_wgpu = { git = "https://github.com/iced-rs/iced.git", rev="fc285d3e461626408c56bbc1605fcf0c974b2f69", features = ["image"] } +iced_widget = { git = "https://github.com/iced-rs/iced.git", rev="fc285d3e461626408c56bbc1605fcf0c974b2f69", features = ["image"] } [[bin]] name = "neothesia" diff --git a/neothesia/src/iced_utils/iced_conversion.rs b/neothesia/src/iced_utils/iced_conversion.rs index b7d2e03c..5ca2a618 100644 --- a/neothesia/src/iced_utils/iced_conversion.rs +++ b/neothesia/src/iced_utils/iced_conversion.rs @@ -50,24 +50,32 @@ pub fn window_event( ) -> Option { use winit::event::WindowEvent; + let id = iced_core::window::Id::MAIN; + match event { WindowEvent::Resized(new_size) => { let logical_size = new_size.to_logical(scale_factor); - Some(Event::Window(window::Event::Resized { - width: logical_size.width, - height: logical_size.height, - })) + Some(Event::Window( + id, + window::Event::Resized { + width: logical_size.width, + height: logical_size.height, + }, + )) } WindowEvent::ScaleFactorChanged { new_inner_size, .. } => { let logical_size = new_inner_size.to_logical(scale_factor); - Some(Event::Window(window::Event::Resized { - width: logical_size.width, - height: logical_size.height, - })) + Some(Event::Window( + id, + window::Event::Resized { + width: logical_size.width, + height: logical_size.height, + }, + )) } - WindowEvent::CloseRequested => Some(Event::Window(window::Event::CloseRequested)), + WindowEvent::CloseRequested => Some(Event::Window(id, window::Event::CloseRequested)), WindowEvent::CursorMoved { position, .. } => { let position = position.to_logical::(scale_factor); @@ -132,23 +140,28 @@ pub fn window_event( WindowEvent::ModifiersChanged(new_modifiers) => Some(Event::Keyboard( keyboard::Event::ModifiersChanged(self::modifiers(*new_modifiers)), )), - WindowEvent::Focused(focused) => Some(Event::Window(if *focused { - window::Event::Focused - } else { - window::Event::Unfocused - })), + WindowEvent::Focused(focused) => Some(Event::Window( + id, + if *focused { + window::Event::Focused + } else { + window::Event::Unfocused + }, + )), WindowEvent::HoveredFile(path) => { - Some(Event::Window(window::Event::FileHovered(path.clone()))) + Some(Event::Window(id, window::Event::FileHovered(path.clone()))) } WindowEvent::DroppedFile(path) => { - Some(Event::Window(window::Event::FileDropped(path.clone()))) + Some(Event::Window(id, window::Event::FileDropped(path.clone()))) + } + WindowEvent::HoveredFileCancelled => { + Some(Event::Window(id, window::Event::FilesHoveredLeft)) } - WindowEvent::HoveredFileCancelled => Some(Event::Window(window::Event::FilesHoveredLeft)), WindowEvent::Touch(touch) => Some(Event::Touch(touch_event(*touch, scale_factor))), WindowEvent::Moved(position) => { let winit::dpi::LogicalPosition { x, y } = position.to_logical(scale_factor); - Some(Event::Window(window::Event::Moved { x, y })) + Some(Event::Window(id, window::Event::Moved { x, y })) } _ => None, }