Skip to content

Commit

Permalink
Release blade-graphics-0.5 and friends (#165)
Browse files Browse the repository at this point in the history
Also update Vulkan deinit function.

Closes #164
  • Loading branch information
kvark authored Aug 28, 2024
1 parent b37a9a9 commit 41827f4
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 43 deletions.
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ 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 }
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 }
Expand All @@ -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 }
Expand All @@ -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
Expand All @@ -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]
Expand All @@ -118,3 +117,4 @@ allowed_external_types = [

[lints.rust]
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(gles)'] }
# not following semver :(
6 changes: 3 additions & 3 deletions blade-egui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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 }
Expand Down
4 changes: 2 additions & 2 deletions blade-graphics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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]
Expand Down
40 changes: 27 additions & 13 deletions blade-graphics/src/vulkan/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}
}
}
4 changes: 2 additions & 2 deletions blade-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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 }
4 changes: 2 additions & 2 deletions blade-render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion blade-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
3 changes: 2 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
8 changes: 2 additions & 6 deletions examples/ray-query/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u16, f32>(TORUS_RADIUS, 1.0, 100, 20);
let vertex_buf = context.create_buffer(gpu::BufferDesc {
name: "vertices",
size: (vertex_values.len() * mem::size_of::<f32>()) as u64,
Expand All @@ -132,10 +132,6 @@ impl Example {
)
};

let indices = indices_usize
.into_iter()
.map(|i| i as u16)
.collect::<Vec<_>>();
let index_buf = context.create_buffer(gpu::BufferDesc {
name: "indices",
size: (indices.len() * mem::size_of::<u16>()) as u64,
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 41827f4

Please sign in to comment.