rendy_command/buffer/
usage.rs1use super::SecondaryLevel;
2
3#[derive(Clone, Copy, Debug, Default)]
6pub struct OneShot;
7
8#[derive(Clone, Copy, Debug, Default)]
10pub struct MultiShot<S = NoSimultaneousUse>(pub S);
11
12#[derive(Clone, Copy, Debug, Default)]
15pub struct SimultaneousUse;
16
17#[derive(Clone, Copy, Debug, Default)]
22pub struct NoSimultaneousUse;
23
24#[derive(Clone, Copy, Debug, Default)]
26pub struct RenderPassContinue;
27
28#[derive(Clone, Copy, Debug, Default)]
31pub struct OutsideRenderPass;
32
33pub trait Usage: Copy + Default + std::fmt::Debug + 'static {
37 fn flags(&self) -> rendy_core::hal::command::CommandBufferFlags;
39}
40
41impl Usage for OneShot {
42 fn flags(&self) -> rendy_core::hal::command::CommandBufferFlags {
43 rendy_core::hal::command::CommandBufferFlags::ONE_TIME_SUBMIT
44 }
45}
46
47impl Usage for MultiShot {
48 fn flags(&self) -> rendy_core::hal::command::CommandBufferFlags {
49 rendy_core::hal::command::CommandBufferFlags::empty()
50 }
51}
52
53impl Usage for MultiShot<SimultaneousUse> {
54 fn flags(&self) -> rendy_core::hal::command::CommandBufferFlags {
55 rendy_core::hal::command::CommandBufferFlags::SIMULTANEOUS_USE
56 }
57}
58
59impl Usage for NoSimultaneousUse {
60 fn flags(&self) -> rendy_core::hal::command::CommandBufferFlags {
61 rendy_core::hal::command::CommandBufferFlags::empty()
62 }
63}
64
65pub trait RenderPassRelation<L>: Copy + Default + std::fmt::Debug + 'static {
68 fn flags(&self) -> rendy_core::hal::command::CommandBufferFlags;
70}
71
72impl RenderPassRelation<SecondaryLevel> for RenderPassContinue {
73 fn flags(&self) -> rendy_core::hal::command::CommandBufferFlags {
74 rendy_core::hal::command::CommandBufferFlags::RENDER_PASS_CONTINUE
75 }
76}
77
78impl<L> RenderPassRelation<L> for OutsideRenderPass {
79 fn flags(&self) -> rendy_core::hal::command::CommandBufferFlags {
80 rendy_core::hal::command::CommandBufferFlags::empty()
81 }
82}