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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
use std::collections::hash_map::{HashMap, Iter as HashMapIter};
use crate::{
resource::{Buffer, Image, Resource},
Id,
};
#[derive(Clone, Copy, Debug)]
pub struct State<R: Resource> {
pub access: R::Access,
pub layout: R::Layout,
pub stages: gfx_hal::pso::PipelineStage,
pub usage: R::Usage,
}
pub type BufferState = State<Buffer>;
pub type ImageState = State<Image>;
#[derive(Clone, Debug)]
pub struct Node {
pub id: usize,
pub family: gfx_hal::queue::QueueFamilyId,
pub dependencies: Vec<usize>,
pub buffers: HashMap<Id, State<Buffer>>,
pub images: HashMap<Id, State<Image>>,
}
impl Node {
pub fn family(&self) -> gfx_hal::queue::QueueFamilyId {
self.family
}
pub fn dependencies(&self) -> &[usize] {
&self.dependencies
}
pub fn buffers(&self) -> HashMapIter<'_, Id, State<Buffer>> {
self.buffers.iter()
}
pub fn images(&self) -> HashMapIter<'_, Id, State<Image>> {
self.images.iter()
}
}