rendy_command/family/
submission.rsuse 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,
}
}
}