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
/// Command buffers of this level can be submitted to the command queues.

#[derive(Clone, Copy, Debug, Default)]
pub struct PrimaryLevel;

/// Command buffers of this level can be executed as part of the primary buffers.

#[derive(Clone, Copy, Debug, Default)]
pub struct SecondaryLevel;

/// Type-level buffer level flag.

/// It defines whether buffer can be submitted to the command queues

/// or executed as part of the primary buffers.

pub trait Level: Copy + Default + std::fmt::Debug + 'static {
    /// Get raw level value for command buffer allocation.

    fn raw_level(&self) -> rendy_core::hal::command::Level;
}

impl Level for PrimaryLevel {
    fn raw_level(&self) -> rendy_core::hal::command::Level {
        rendy_core::hal::command::Level::Primary
    }
}

impl Level for SecondaryLevel {
    fn raw_level(&self) -> rendy_core::hal::command::Level {
        rendy_core::hal::command::Level::Secondary
    }
}