Skip to content

Commit

Permalink
Release ash 0.38.0 and ash-window 0.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Mar 31, 2024
1 parent 1733ab4 commit dcd6a66
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
28 changes: 21 additions & 7 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] - ReleaseDate

## [0.38.0] - 2023-03-31
## [0.38.0] - 2024-03-31

With over two years of collecing breaking changes (since the `0.37.0` release in March 2022), March 2024 marks the next breaking release of `ash`. This release introduces an overhaul of all Vulkan structures, restructures modules around extensions, and separates extension wrappers between `Instance` and `Device` functions. The crate contains all bindings defined by the latest `1.3.281` Vulkan specification, and many old and new extensions have received a hand-written extension wrapper. For a full overview of all individual changes, see the list at the end of this post.

### Replaced builders with lifetimes/setters directly on Vulkan structs

Calling `.build()` on a `Builder` struct has always been discouraged for dropping lifetime information, in favour of using `Deref`. This `Deref` mechanism is especially hard to use in arrays of structures. Likewise, a builder pattern entices users to call `.build()` and there was no documentation besides the `README` discouraging users from using it, while providing various alternatives.

Instead all `Builder` structs have been removed, and their builder functions and lifetime generic have moved to the underlying Vulkan struct. This means all types will carry the lifetime information of contained references at all times, when created using the builder pattern.
All `Builder` structs have been removed, and their builder functions and lifetime generic have moved to the underlying Vulkan struct. This means all types will carry the lifetime information of contained references at all times, when created using the builder pattern.

Where one used to call:

Expand All @@ -38,11 +36,27 @@ And `queue_info` relies on the borrow checker to ensure it no longer outlives `&

### Separating extension loaders and wrappers between `instance` and `device` functions

Just like the separation between `InstanceFnV1_x` and `Device_FnV1_x` for Vulkan core functions, some extensions contain both `instance`-level and `device`-level functions with different loader semantics. All extensions now have a separate generated `InstanceFn` and `DeviceFn` function pointer table (when containing one or more functions), separating out the two. High-level extension wrappers are updated to match via a separate `Instance` and `Device` struct inside a module carrying the extension name (see also below), instead of a single struct containing both the prefix and extension name (e.g. `KhrSwapchain`). These modules are generated for all extensions including those without functions (for which no `Instance` or `Device` struct is generated), complete with a reexport of the extension name.
Just like the separation between `InstanceFnV1_x` and `Device_FnV1_x` for Vulkan core functions, all extensions now have a separate generated `InstanceFn` and `DeviceFn` function pointer table (when containing one or more functions), separating out the two.

High-level extension wrappers are updated to match via a separate `Instance` and `Device` struct inside a module carrying the extension name (see also below), instead of residing in a single struct. These modules are generated for all extensions including those without functions (for which no `Instance` or `Device` struct is generated), complete with a reexport of the extension name and version.

### Restructuring of modules around extensions, function-pointer tables and high-level wrappers

High-level extension wrappers were always available under `ash::extensions::` for extensions with functions, and paired with helpers to reexport the `CStr` extension name from `ash::vk::`. For extensions without functions no wrapper is needed nor written, leading to an inconsistent split and confusion among users when referencing some via `ash::extensions::KhrSwapchain::name()` and others via `ash::vk::ExtDescriptorIndexingFn::name()`. Together with the aforementioned split between `Instance`-level and `Device`-level function wrappers, all low-level `sys`-like extension bindings are now available under `ash::vk::<prefix>::<extension name>::*` and a matching high-level module containing the `ash::<prefix>::<extension name>::*`
Function pointer tables for both core and extensions have moved out of the "pure" `sys`-like `ash::vk::` module, into the `ash::` root for core `*FnV1_x` tables and into the extension module `ash::<prefix>::<extension name>::{InstanceFn, DeviceFn}` for extensions. High-level wrappers for these structs (originally from the `ash::extensions` module), together with the `Instance` and `Device` structure split detailed above, have also moved into this module.

For example, `ash::vk::KhrSwapchainFn` is now available as `ash::khr::swapchain::{InstanceFn, DeviceFn}`, and the high-level `ash::extensions::KhrSwapchain` wrapper is available at `ash::khr::swapchain::{Instance, Device}`. The extension name and version are found under `ash::khr::swapchain::{NAME, SPEC_VERSION}`.

### Misc helpers

Various miscellaneous helpers have been introduced on low-level Vulkan structs.

For statically-sized arrays with a field bounding their length (e.g. `ash::vk::PhysicalDeviceMemoryProperties::memory_types` with the `memory_types_count` field) a new `_as_slice()` getter is available to retrieve the initialized portion of the slice.

For null-terminated strings stored in statically-sized arrays, both `_as_c_str()` getters and more convenient setter is introduced based on the `CStr` type, providing `Result`-based access to these fields.

### `no_std` support

By disabling the default `std` feature, this crate compiles in a [`no_std` environment](https://docs.rust-embedded.org/book/intro/no-std.html).

### Added

Expand Down Expand Up @@ -508,7 +522,7 @@ flags: vk::CommandPoolCreateFlags::RESET_COMMAND_BUFFER_BIT,
- `ash::util::Align` is a helper struct that
can write to aligned memory.

[Unreleased]: https://github.com/ash-rs/ash/compare/0.37.2...HEAD
[Unreleased]: https://github.com/ash-rs/ash/compare/0.38.0...HEAD
[0.38.0]: https://github.com/ash-rs/ash/releases/tag/0.38.0
[0.37.2]: https://github.com/ash-rs/ash/releases/tag/0.37.2
[0.37.1]: https://github.com/ash-rs/ash/releases/tag/0.37.1
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ A very lightweight wrapper around Vulkan
- [x] Additional type safety
- [x] Device local function pointer loading
- [x] No validation, everything is **unsafe**
- [x] Lifetime-safety on structs created with the builder pattern
- [x] Generated from `vk.xml`
- [x] Support for Vulkan `1.1`, `1.2`, `1.3`
- [x] `no_std` support
Expand Down
6 changes: 3 additions & 3 deletions ash-window/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ash-window"
version = "0.12.0"
version = "0.13.0"
authors = [
"msiglreith <m.siglreith@gmail.com>",
"Marijn Suijten <marijn@traverseresearch.nl>",
Expand All @@ -19,15 +19,15 @@ edition = "2021"
rust-version = "1.69.0"

[dependencies]
ash = { path = "../ash", version = "0.37", default-features = false, features = ["std"] }
ash = { path = "../ash", version = "0.38", default-features = false, features = ["std"] }
raw-window-handle = "0.6"

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
raw-window-metal = "0.4"

[dev-dependencies]
winit = { version = "0.29", features = ["rwh_06"] }
ash = { path = "../ash", version = "0.37", default-features = false, features = ["linked"] }
ash = { path = "../ash", version = "0.38", default-features = false, features = ["linked"] }

[[example]]
name = "winit"
Expand Down
6 changes: 4 additions & 2 deletions ash-window/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

## [Unreleased] - ReleaseDate
## [0.13.0] - 2024-03-31

- Bumped MSRV from 1.59 to 1.69 for `winit 0.28` and `raw-window-handle 0.5.1`, and `CStr::from_bytes_until_nul`. (#709, #716, #746)
- Bumped `raw-window-handle` to `0.6.0` (#799)
- Bumped `ash` version to [`0.38`](https://github.com/ash-rs/ash/releases/tag/0.38.0) (#TODO)

## [0.12.0] - 2022-09-23

Expand Down Expand Up @@ -86,7 +87,8 @@
## Version 0.1.0
Initial release for `raw-window-handle = "0.3"` with Windows, Linux, Android, MacOS/iOS support.

[Unreleased]: https://github.com/ash-rs/ash/compare/ash-window-0.12.0...HEAD
[Unreleased]: https://github.com/ash-rs/ash/compare/ash-window-0.13.0...HEAD
[0.12.0]: https://github.com/ash-rs/ash/releases/tag/ash-window-0.13.0
[0.12.0]: https://github.com/ash-rs/ash/releases/tag/ash-window-0.12.0
[0.11.0]: https://github.com/ash-rs/ash/releases/tag/ash-window-0.11.0
[0.10.0]: https://github.com/ash-rs/ash/releases/tag/ash-window-0.10.0
Expand Down
2 changes: 1 addition & 1 deletion ash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ash"
version = "0.37.0+1.3.281"
version = "0.38.0+1.3.281"
authors = [
"Maik Klein <maikklein@googlemail.com>",
"Benjamin Saunders <ben.e.saunders@gmail.com>",
Expand Down

0 comments on commit dcd6a66

Please sign in to comment.