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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
use crate::buffer::{NoSimultaneousUse, OutsideRenderPass, PrimaryLevel, Submit, Submittable};
#[allow(unused)]
type NoWaits<B> = std::iter::Empty<(
&'static <B as rendy_core::hal::Backend>::Semaphore,
rendy_core::hal::pso::PipelineStage,
)>;
#[allow(unused)]
type NoSignals<B> = std::iter::Empty<&'static <B as rendy_core::hal::Backend>::Semaphore>;
#[allow(unused)]
type NoSubmits<B> = std::iter::Empty<Submit<B, NoSimultaneousUse, PrimaryLevel, OutsideRenderPass>>;
#[derive(Debug)]
pub struct Submission<B, W = NoWaits<B>, C = NoSubmits<B>, S = NoSignals<B>> {
pub waits: W,
pub submits: C,
pub signals: S,
pub marker: std::marker::PhantomData<fn() -> B>,
}
impl<B> Submission<B>
where
B: rendy_core::hal::Backend,
{
pub fn new() -> Self {
Submission {
waits: std::iter::empty(),
submits: std::iter::empty(),
signals: std::iter::empty(),
marker: std::marker::PhantomData,
}
}
}
impl<B, W, S> Submission<B, W, NoSubmits<B>, S>
where
B: rendy_core::hal::Backend,
{
pub fn submits<C>(self, submits: C) -> Submission<B, W, C, S>
where
C: IntoIterator,
C::Item: Submittable<B>,
{
Submission {
waits: self.waits,
submits,
signals: self.signals,
marker: self.marker,
}
}
}
impl<B, C, S> Submission<B, NoWaits<B>, C, S>
where
B: rendy_core::hal::Backend,
{
pub fn wait<'a, W, E>(self, waits: W) -> Submission<B, W, C, S>
where
W: IntoIterator<Item = (&'a E, rendy_core::hal::pso::PipelineStage)>,
E: std::borrow::Borrow<B::Semaphore> + 'a,
{
Submission {
waits,
submits: self.submits,
signals: self.signals,
marker: self.marker,
}
}
}
impl<B, W, C> Submission<B, W, C, NoSignals<B>>
where
B: rendy_core::hal::Backend,
{
pub fn signal<'a, S, E>(self, signals: S) -> Submission<B, W, C, S>
where
S: IntoIterator<Item = &'a E>,
E: std::borrow::Borrow<B::Semaphore> + 'a,
{
Submission {
waits: self.waits,
submits: self.submits,
signals,
marker: self.marker,
}
}
}