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
use super::state::*;

/// This flag specify that buffer can be reset individually.
#[derive(Clone, Copy, Debug, Default)]
pub struct IndividualReset;

/// This flag specify that buffer cannot be reset individually.
#[derive(Clone, Copy, Debug, Default)]
pub struct NoIndividualReset;

/// Specify flags required for command pool creation to allow individual buffer reset.
pub trait Reset: Copy + Default + std::fmt::Debug + 'static {
    /// Get flags for reset parameter.
    fn flags(&self) -> rendy_core::hal::pool::CommandPoolCreateFlags;
}

impl Reset for IndividualReset {
    fn flags(&self) -> rendy_core::hal::pool::CommandPoolCreateFlags {
        rendy_core::hal::pool::CommandPoolCreateFlags::RESET_INDIVIDUAL
    }
}

impl Reset for NoIndividualReset {
    fn flags(&self) -> rendy_core::hal::pool::CommandPoolCreateFlags {
        rendy_core::hal::pool::CommandPoolCreateFlags::empty()
    }
}

/// States in which command buffer can de reset.
pub trait Resettable {}
impl Resettable for InitialState {}
impl<U, P> Resettable for RecordingState<U, P> {}
impl<U, P> Resettable for ExecutableState<U, P> {}
impl Resettable for InvalidState {}