aboutsummaryrefslogtreecommitdiff
path: root/stockton-render/src/draw/utils.rs
blob: df62bb87866cd2f0a10636543259bd14d9dfeb25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::types::*;
use hal::{memory::Properties as MemProperties, prelude::*, MemoryTypeId};

pub fn find_memory_type_id(
    adapter: &Adapter,
    type_mask: u64,
    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))
}