diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
commit | 0353181306702c40ad0fe482b5c2b159b46794a4 (patch) | |
tree | 33acc6a9e8ea4705884cf93b78cf869008f71832 /stockton-skeleton/src/utils.rs | |
parent | 664f0b0777ba96298b29f0c753d52a81cbb233f1 (diff) |
refactor(all): rename some crates
Diffstat (limited to 'stockton-skeleton/src/utils.rs')
-rw-r--r-- | stockton-skeleton/src/utils.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/stockton-skeleton/src/utils.rs b/stockton-skeleton/src/utils.rs new file mode 100644 index 0000000..152ba10 --- /dev/null +++ b/stockton-skeleton/src/utils.rs @@ -0,0 +1,19 @@ +use crate::types::*; +use hal::{memory::Properties as MemProperties, MemoryTypeId}; + +pub fn find_memory_type_id( + adapter: &Adapter, + type_mask: u32, + props: MemProperties, +) -> Option<MemoryTypeId> { + adapter + .physical_device + .memory_properties() + .memory_types + .iter() + .enumerate() + .find(|&(id, memory_type)| { + type_mask & (1 << id) != 0 && memory_type.properties.contains(props) + }) + .map(|(id, _)| MemoryTypeId(id)) +} |