rendy_command/buffer/
state.rs

1use super::usage::{MultiShot, OutsideRenderPass};
2
3/// Command buffer state in which all buffers start.
4/// Resetting also moves buffer to this state.
5#[derive(Clone, Copy, Debug, Default)]
6pub struct InitialState;
7
8/// Command buffer in recording state could be populated with commands.
9#[derive(Clone, Copy, Debug, Default)]
10pub struct RecordingState<U = MultiShot, P = OutsideRenderPass>(pub U, pub P);
11
12/// Command buffer in executable state can be submitted.
13#[derive(Clone, Copy, Debug, Default)]
14pub struct ExecutableState<U = MultiShot, P = OutsideRenderPass>(pub U, pub P);
15
16/// Command buffer in pending state are submitted to the device.
17/// Command buffer in pending state must never be invalidated or reset because device may read it at the moment.
18/// Proving device is done with buffer requires nontrivial strategies.
19/// Therefore moving buffer from pending state requires `unsafe` method.
20#[derive(Clone, Copy, Debug, Default)]
21pub struct PendingState<N = ExecutableState>(pub N);
22
23/// Command buffer in pending state are submitted to the device.
24/// Command buffer in pending state must never be invalidated or reset because device may read it at the moment.
25/// Proving device is done with buffer requires nontrivial strategies.
26/// Therefore moving buffer from pending state requires `unsafe` method.
27/// This type alias can be used for one-shot command buffers.
28pub type PendingOnceState = PendingState<InvalidState>;
29
30/// One-shot buffers move to invalid state after execution.
31/// Invalidating any resource referenced in any command recorded to the buffer implicitly move it to the invalid state.
32#[derive(Clone, Copy, Debug, Default)]
33pub struct InvalidState;