1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use crate::types::{DescriptorPoolCreateFlags, DescriptorTotalCount};
#[derive(Debug)]
pub enum CreatePoolError {
OutOfDeviceMemory,
OutOfHostMemory,
Fragmentation,
}
#[derive(Debug)]
pub enum DeviceAllocationError {
OutOfDeviceMemory,
OutOfHostMemory,
OutOfPoolMemory,
FragmentedPool,
}
pub trait DescriptorDevice<L, P, S> {
unsafe fn create_descriptor_pool(
&self,
descriptor_count: &DescriptorTotalCount,
max_sets: u32,
flags: DescriptorPoolCreateFlags,
) -> Result<P, CreatePoolError>;
unsafe fn destroy_descriptor_pool(&self, pool: P);
unsafe fn alloc_descriptor_sets<'a>(
&self,
pool: &mut P,
layouts: impl ExactSizeIterator<Item = &'a L>,
sets: &mut impl Extend<S>,
) -> Result<(), DeviceAllocationError>
where
L: 'a;
unsafe fn dealloc_descriptor_sets<'a>(&self, pool: &mut P, sets: impl Iterator<Item = S>);
}