Skip to content

Commit

Permalink
Bump to 1.75.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo-Zhixing committed Oct 18, 2024
1 parent 12a512c commit da17384
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.69.0
- uses: dtolnay/rust-toolchain@1.75.0
- name: Check ash, ash-window and ash-rewrite
run: cargo check -p ash -p ash-rewrite -p ash-window --all-features
- name: Check ash with no_std
Expand Down
2 changes: 1 addition & 1 deletion ash-rewrite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ categories = [
documentation = "https://docs.rs/ash"
edition = "2021"
# TODO: reevaluate, then update in ci.yml
rust-version = "1.69.0"
rust-version = "1.75.0"

[dependencies]
libloading = { version = "0.8", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion ash-window/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ categories = [
"rendering::graphics-api"
]
edition = "2021"
rust-version = "1.69.0"
rust-version = "1.75.0"

[dependencies]
ash = { path = "../ash", version = "0.38", default-features = false, features = ["std"] }
Expand Down
2 changes: 1 addition & 1 deletion ash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ categories = [
"rendering::graphics-api"
]
edition = "2021"
rust-version = "1.69.0"
rust-version = "1.75.0"

[dependencies]
libloading = { version = "0.8", optional = true }
Expand Down
22 changes: 19 additions & 3 deletions ash/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ pub trait NextChainExt<'a>: TaggedStructure<'a> {
self
}
/// Returns a mutable iterator over the entire extension chain attached to `Self`
fn iter_next_chain_mut(&'a mut self) -> impl Iterator<Item = &'a mut TaggedObject<'a>> + 'a {
(0..).scan(self.as_base_mut().p_next, |p_ptr, _| unsafe {
fn iter_next_chain_mut(&mut self) -> impl Iterator<Item = &'a mut TaggedObject<'a>> {
(0..).scan(self.as_base_mut().p_next, move |p_ptr, _| unsafe {
if p_ptr.is_null() {
return None;
}
Expand All @@ -197,7 +197,7 @@ pub trait NextChainExt<'a>: TaggedStructure<'a> {
})
}
/// Returns an iterator over the entire extension chain attached to `Self`
fn iter_next_chain(&'a self) -> impl Iterator<Item = &'a TaggedObject<'a>> + 'a {
fn iter_next_chain(&self) -> impl Iterator<Item = &'a TaggedObject<'a>> {
(0..).scan(self.as_base().p_next, |p_ptr, _| unsafe {
if p_ptr.is_null() {
return None;
Expand Down Expand Up @@ -319,6 +319,22 @@ impl<'a> TaggedObject<'a> {
pub fn from_mut<T: TaggedStructure<'a> + ?Sized>(obj: &mut T) -> &mut Self {
unsafe { &mut *(<*mut T>::cast(obj)) }
}
pub fn next(&self) -> Option<&Self> {
unsafe {
if self.as_base().p_next.is_null() {
return None;
}
Some(TaggedObject::from_raw(self.as_base().p_next))
}
}
pub fn next_mut(&mut self) -> Option<&mut Self> {
unsafe {
if self.as_base().p_next.is_null() {
return None;
}
Some(TaggedObject::from_raw_mut(self.as_base_mut().p_next))
}
}
pub fn tag(&self) -> vk::StructureType {
self.as_base().s_type
}
Expand Down
11 changes: 7 additions & 4 deletions ash/src/vk/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,19 @@ impl From<vk::Extent2D> for vk::Rect2D {
}
}

/// Marker trait for tagged vulkan structures.
///
/// Structures implementing this trait are layout-compatible with [`vk::BaseInStructure`] and
/// [`vk::BaseOutStructure`]. Such structures have an `s_type` field indicating its type, which
/// must always match the value of [`TaggedStructure::STRUCTURE_TYPE`].
/// [`vk::BaseOutStructure`]. Types implementing this trait have an `s_type` field indicating
/// its type, which must always match the value of [`TaggedStructure::STRUCTURE_TYPE`], unless
/// it is a [`crate::util::TaggedObject`].
pub unsafe trait TaggedStructure<'a> {
const STRUCTURE_TYPE: vk::StructureType;
fn as_base_mut(&mut self) -> &mut vk::BaseOutStructure<'a> {
unsafe { &mut *(<*mut Self>::cast(self) as *mut vk::BaseOutStructure<'a>) }
unsafe { &mut *(<*mut Self>::cast(self)) }
}
fn as_base(&self) -> &vk::BaseInStructure<'a> {
unsafe { &*(<*const Self>::cast(self) as *const vk::BaseInStructure<'a>) }
unsafe { &*(<*const Self>::cast(self)) }
}
}

Expand Down

0 comments on commit da17384

Please sign in to comment.