diff --git a/Cargo.lock b/Cargo.lock index 3961e17..79fee16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,12 +62,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "as-raw-xcb-connection" -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" @@ -133,7 +127,7 @@ dependencies = [ [[package]] name = "baseview" version = "0.1.0" -source = "git+https://github.com/RustAudio/baseview.git#45465c5f46abed6c6ce370fffde5edc8e4cd5aa3" +source = "git+https://github.com/RustAudio/baseview.git?rev=2c1b1a7b0fef1a29a5150a6a8f6fef6a0cbab8c4#2c1b1a7b0fef1a29a5150a6a8f6fef6a0cbab8c4" dependencies = [ "cocoa", "core-foundation", @@ -144,7 +138,8 @@ dependencies = [ "uuid", "winapi", "x11", - "x11rb", + "xcb", + "xcb-util", ] [[package]] @@ -191,6 +186,20 @@ name = "bytemuck" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.64", +] [[package]] name = "camino" @@ -409,16 +418,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys", -] - [[package]] name = "flume" version = "0.11.0" @@ -485,16 +484,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" -[[package]] -name = "gethostname" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" -dependencies = [ - "libc", - "windows-targets 0.48.5", -] - [[package]] name = "getrandom" version = "0.2.15" @@ -733,12 +722,6 @@ dependencies = [ "windows-targets 0.52.5", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - [[package]] name = "lock_api" version = "0.4.12" @@ -1120,19 +1103,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustix" -version = "0.38.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" -dependencies = [ - "bitflags 2.5.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - [[package]] name = "ryu" version = "1.0.18" @@ -1898,23 +1868,25 @@ dependencies = [ ] [[package]] -name = "x11rb" -version = "0.13.1" +name = "xcb" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" +checksum = "62056f63138b39116f82a540c983cc11f1c90cd70b3d492a70c25eaa50bd22a6" dependencies = [ - "as-raw-xcb-connection", - "gethostname", "libc", - "rustix", - "x11rb-protocol", + "log", + "x11", ] [[package]] -name = "x11rb-protocol" -version = "0.13.1" +name = "xcb-util" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" +checksum = "43893e47f27bf7d81d489feef3a0e34a457e90bc314b7e74ad9bb3980e4c1c48" +dependencies = [ + "libc", + "xcb", +] [[package]] name = "xml-rs" diff --git a/Cargo.toml b/Cargo.toml index 122c2ea..e273280 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,12 +14,12 @@ members = ["xtask"] crate-type = ["cdylib"] [dependencies] -bytemuck = "1.16.0" +bytemuck = { version = "1.16.0", features = ["derive"] } # Remove the `assert_process_allocs` feature to allow allocations on the audio # thread in debug builds. nih_plug = { git = "https://github.com/robbert-vdh/nih-plug.git", features = ["assert_process_allocs"] } wgpu = { version = "0.18" } -baseview = {git = "https://github.com/RustAudio/baseview.git"} +baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "2c1b1a7b0fef1a29a5150a6a8f6fef6a0cbab8c4" } pollster = "0.3.0" # Uncomment the below line to disable the on-by-default VST3 feature to remove # the GPL compatibility requirement diff --git a/src/editor.rs b/src/editor.rs index d16dafe..bb9dedf 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -12,4 +12,24 @@ impl Editor for WgpuEditor { let renderer = WgpuRenderer::start(parent); Box::new(renderer) } + + fn size(&self) -> (u32, u32) { + todo!() + } + + fn set_scale_factor(&self, factor: f32) -> bool { + todo!() + } + + fn param_value_changed(&self, id: &str, normalized_value: f32) { + todo!() + } + + fn param_modulation_changed(&self, id: &str, modulation_offset: f32) { + todo!() + } + + fn param_values_changed(&self) { + todo!() + } } diff --git a/src/render.rs b/src/render.rs index 8cf45a4..00cb135 100644 --- a/src/render.rs +++ b/src/render.rs @@ -1,3 +1,5 @@ +use std::sync::Arc; + use baseview::MouseEvent; use baseview::Size; use baseview::Window; @@ -26,7 +28,7 @@ pub struct WgpuRenderer { impl<'a> WgpuRenderer { pub async fn new(window: &mut Window<'a>) -> Self { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::default()); - let surface = unsafe { instance.create_surface(&window) }.unwrap(); + let surface = unsafe { instance.create_surface(&*window) }.unwrap(); let adapter = instance .request_adapter(&wgpu::RequestAdapterOptions { power_preference: wgpu::PowerPreference::default(), @@ -161,15 +163,18 @@ impl<'a> WgpuRenderer { title: "wgpu on baseview".into(), size: Size::new(WINDOW_SIZE as f64, WINDOW_SIZE as f64), scale: baseview::WindowScalePolicy::SystemScaleFactor, - gl_config: None, + // gl_config: None, }; - Window::open_parented(&parent, window_open_options, |window| { - pollster::block_on(WgpuRenderer::new(window)) - }) + Window::open_parented( + &parent, + window_open_options, + move |window: &mut Window<'_>| -> WgpuRenderer { + pollster::block_on(WgpuRenderer::new(window)) + }, + ) } } - impl WindowHandler for WgpuRenderer { fn on_frame(&mut self, _window: &mut baseview::Window) { let output = self.surface.get_current_texture().unwrap();