From 875b9c87e15e83ed48414c094f9a2b3fb189925d Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 27 Aug 2024 22:12:33 -0700 Subject: [PATCH] Release blade-graphics-0.5 and friends Also update Vulkan deinit function. --- Cargo.toml | 20 ++++++++-------- blade-egui/Cargo.toml | 6 ++--- blade-graphics/Cargo.toml | 4 ++-- blade-graphics/src/vulkan/init.rs | 40 +++++++++++++++++++++---------- blade-macros/Cargo.toml | 4 ++-- blade-render/Cargo.toml | 4 ++-- blade-util/Cargo.toml | 2 +- docs/CHANGELOG.md | 3 ++- examples/ray-query/main.rs | 8 ++----- src/lib.rs | 6 ++--- 10 files changed, 54 insertions(+), 43 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f991fc08..03c104ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,8 +45,8 @@ readme = "docs/README.md" [dependencies] blade-asset = { version = "0.2", path = "blade-asset" } -blade-egui = { version = "0.3", path = "blade-egui" } -blade-graphics = { version = "0.4", path = "blade-graphics" } +blade-egui = { version = "0.4", path = "blade-egui" } +blade-graphics = { version = "0.5", path = "blade-graphics" } blade-helpers = { version = "0.1", path = "blade-helpers" } blade-util = { version = "0.1", path = "blade-util" } base64 = { workspace = true } @@ -54,12 +54,12 @@ choir = { workspace = true } colorsys = "0.6" egui = { workspace = true } gltf = { workspace = true } -nalgebra = { version = "0.32", features = ["mint"] } +nalgebra = { version = "0.33", features = ["mint"] } log = { workspace = true } mint = { workspace = true, features = ["serde"] } num_cpus = "1" profiling = { workspace = true } -rapier3d = { version = "0.19", features = ["debug-render"] } +rapier3d = { version = "0.22", features = ["debug-render"] } serde = { version = "1", features = ["serde_derive"] } slab = "0.4" winit = { workspace = true } @@ -68,12 +68,12 @@ winit = { workspace = true } blade-render = { version = "0.3", path = "blade-render" } [dev-dependencies] -blade-macros = { version = "0.2", path = "blade-macros" } +egui_plot = "0.28" +blade-macros = { version = "0.3", path = "blade-macros" } bytemuck = { workspace = true } choir = { workspace = true } egui = { workspace = true } transform-gizmo-egui = { git = "https://github.com/urholaukkarinen/transform-gizmo", rev = "5be085444468ff7059abcd4e4872ab4510f65a06" } -egui_plot = "0.28" env_logger = "0.11" glam = { workspace = true } log = { workspace = true } @@ -84,9 +84,8 @@ profiling = { workspace = true } ron = "0.8" serde = { version = "1", features = ["serde_derive"] } strum = { workspace = true } -# not following semver :( -del-msh = "=0.1.25" -del-geo = "=0.1.19" +del-msh-core = "=0.1.33" +del-geo = "=0.1.29" [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] # see https://github.com/emilk/egui/issues/4270 @@ -99,7 +98,7 @@ web-sys = { workspace = true, features = ["Window"] } getrandom = { version = "0.2", features = ["js"] } [target.'cfg(any(target_os = "windows", target_os = "linux"))'.dev-dependencies] -renderdoc = "0.11" +renderdoc = "0.12" # This is too slow in Debug [profile.dev.package.texpresso] @@ -118,3 +117,4 @@ allowed_external_types = [ [lints.rust] unexpected_cfgs = { level = "allow", check-cfg = ['cfg(gles)'] } +# not following semver :( diff --git a/blade-egui/Cargo.toml b/blade-egui/Cargo.toml index 5d20f22c..71ce847f 100644 --- a/blade-egui/Cargo.toml +++ b/blade-egui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blade-egui" -version = "0.3.0" +version = "0.4.0" edition = "2021" description = "egui integration for Blade" keywords = ["graphics"] @@ -10,8 +10,8 @@ repository = "https://github.com/kvark/blade" [lib] [dependencies] -blade-graphics = { version = "0.4", path = "../blade-graphics" } -blade-macros = { version = "0.2", path = "../blade-macros" } +blade-graphics = { version = "0.5", path = "../blade-graphics" } +blade-macros = { version = "0.3", path = "../blade-macros" } blade-util = { version = "0.1", path = "../blade-util" } egui = { workspace = true, features = ["bytemuck"] } bytemuck = { workspace = true } diff --git a/blade-graphics/Cargo.toml b/blade-graphics/Cargo.toml index 799c78db..226bd3ca 100644 --- a/blade-graphics/Cargo.toml +++ b/blade-graphics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blade-graphics" -version = "0.4.0" +version = "0.5.0" edition = "2021" description = "Graphics abstraction for Blade" keywords = ["graphics"] @@ -35,7 +35,7 @@ naga = { workspace = true, features = ["spv-out"] } slab = { workspace = true } [target.'cfg(any(gles, target_arch = "wasm32"))'.dependencies] -glow = "0.13" +glow = "0.14" naga = { workspace = true, features = ["glsl-out"] } [target.'cfg(all(gles, not(target_arch = "wasm32")))'.dependencies] diff --git a/blade-graphics/src/vulkan/init.rs b/blade-graphics/src/vulkan/init.rs index d670d949..053a3be3 100644 --- a/blade-graphics/src/vulkan/init.rs +++ b/blade-graphics/src/vulkan/init.rs @@ -924,17 +924,8 @@ impl super::Context { .unwrap() }; - // destroy the old swapchain unsafe { - surface.extension.destroy_swapchain(surface.swapchain, None); - } - for frame in surface.frames.drain(..) { - unsafe { - self.device.core.destroy_image_view(frame.view, None); - self.device - .core - .destroy_semaphore(frame.acquire_semaphore, None); - } + surface.deinit_swapchain(&self.device.core); } let images = unsafe { @@ -1016,16 +1007,39 @@ impl super::Context { } } +impl super::Surface { + unsafe fn deinit_swapchain(&mut self, ash_device: &ash::Device) { + self.extension.destroy_swapchain(self.swapchain, None); + for frame in self.frames.drain(..) { + ash_device.destroy_image_view(frame.view, None); + ash_device.destroy_semaphore(frame.acquire_semaphore, None); + } + } +} + impl Drop for super::Context { fn drop(&mut self) { unsafe { - if let Some(surface) = &self.surface { - if let Some(surface_instance) = &self.instance.surface { - surface_instance.destroy_surface(surface.lock().unwrap().raw, None); + if let Some(surface_mutex) = self.surface.take() { + let mut surface = surface_mutex.into_inner().unwrap(); + surface.deinit_swapchain(&self.device.core); + self.device + .core + .destroy_semaphore(surface.next_semaphore, None); + if let Some(surface_instance) = self.instance.surface.take() { + surface_instance.destroy_surface(surface.raw, None); } } self.device.core.destroy_device(None); self.instance.core.destroy_instance(None); + if let Ok(queue) = self.queue.lock() { + self.device + .core + .destroy_semaphore(queue.timeline_semaphore, None); + self.device + .core + .destroy_semaphore(queue.present_semaphore, None); + } } } } diff --git a/blade-macros/Cargo.toml b/blade-macros/Cargo.toml index 0559add8..e3968d69 100644 --- a/blade-macros/Cargo.toml +++ b/blade-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blade-macros" -version = "0.2.1" +version = "0.3.0" edition = "2021" description = "Macros helpers for Blade users" keywords = ["proc-macro"] @@ -16,7 +16,7 @@ proc-macro2 = "1" quote = "1.0" [dev-dependencies] -blade-graphics = { version = "0.4", path = "../blade-graphics" } +blade-graphics = { version = "0.5", path = "../blade-graphics" } blade-asset = { version = "0.2", path = "../blade-asset" } bytemuck = { workspace = true } mint = { workspace = true } diff --git a/blade-render/Cargo.toml b/blade-render/Cargo.toml index 7017bfd9..85a67a8f 100644 --- a/blade-render/Cargo.toml +++ b/blade-render/Cargo.toml @@ -28,9 +28,9 @@ asset = [ [dependencies] base64 = { workspace = true, optional = true } bitflags = { workspace = true } -blade-graphics = { version = "0.4", path = "../blade-graphics" } +blade-graphics = { version = "0.5", path = "../blade-graphics" } blade-asset = { version = "0.2", path = "../blade-asset" } -blade-macros = { version = "0.2.1", path = "../blade-macros" } +blade-macros = { version = "0.3", path = "../blade-macros" } bytemuck = { workspace = true } choir = { workspace = true } exr = { version = "1.6", optional = true } diff --git a/blade-util/Cargo.toml b/blade-util/Cargo.toml index 7c9a61ea..b4b98388 100644 --- a/blade-util/Cargo.toml +++ b/blade-util/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/kvark/blade" [lib] [dependencies] -blade-graphics = { version = "0.4", path = "../blade-graphics" } +blade-graphics = { version = "0.5", path = "../blade-graphics" } bytemuck = { workspace = true } log = { workspace = true } profiling = { workspace = true } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b6fd9672..2014f4b8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,6 @@ Changelog for Blade -## blade-graphics-0.5, blade-macros-0.3, blade-egui-0.4, blade-util-0.1 (TBD) +## blade-graphics-0.5, blade-macros-0.3, blade-egui-0.4, blade-util-0.1 (27 Aug 2024) - crate: `blade-util` for helper utilities - graphics: @@ -15,6 +15,7 @@ Changelog for Blade - fixed initial RAM consumption - worked around Intel descriptor memory allocation bug - fixed coherent memory requirements + - rudimentary cleanup on destruction - GLES: - support for storage buffer and compute - scissor rects, able to run "particle" example diff --git a/examples/ray-query/main.rs b/examples/ray-query/main.rs index 76ad48a9..c004d1bc 100644 --- a/examples/ray-query/main.rs +++ b/examples/ray-query/main.rs @@ -117,8 +117,8 @@ impl Example { depth_stencil: None, }); - let (indices_usize, vertex_values) = - del_msh::trimesh3_primitive::torus_yup(TORUS_RADIUS, 1.0, 100, 20); + let (indices, vertex_values) = + del_msh_core::trimesh3_primitive::torus_yup::(TORUS_RADIUS, 1.0, 100, 20); let vertex_buf = context.create_buffer(gpu::BufferDesc { name: "vertices", size: (vertex_values.len() * mem::size_of::()) as u64, @@ -132,10 +132,6 @@ impl Example { ) }; - let indices = indices_usize - .into_iter() - .map(|i| i as u16) - .collect::>(); let index_buf = context.create_buffer(gpu::BufferDesc { name: "indices", size: (indices.len() * mem::size_of::()) as u64, diff --git a/src/lib.rs b/src/lib.rs index 5054a109..5c8320b6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,9 +114,9 @@ impl JointAxis { fn into_rapier(self) -> rapier3d::dynamics::JointAxis { use rapier3d::dynamics::JointAxis as Ja; match self { - Self::LinearX => Ja::X, - Self::LinearY => Ja::Y, - Self::LinearZ => Ja::Z, + Self::LinearX => Ja::LinX, + Self::LinearY => Ja::LinY, + Self::LinearZ => Ja::LinZ, Self::AngularX => Ja::AngX, Self::AngularY => Ja::AngY, Self::AngularZ => Ja::AngZ,