pub struct DoubleBufferedSubmitter { /* private fields */ }Expand description
Double-buffered GPU command submission.
Maintains two independent CommandBuffer slots (A and B). While the GPU
executes the commands in slot B, the CPU records new work into slot A, and
vice-versa. This overlaps CPU recording with GPU execution to maximise
throughput.
§Typical cycle (one frame)
1. begin_record(recording_slot) → SlotState::Recording
2. … record commands …
3. finish_record(recording_slot) → SlotState::ReadyToSubmit
4. submit(recording_slot) → SlotState::Inflight
5. mark_retired(other_slot) → SlotState::Retired (after GPU fence)
6. reset(retired_slot) → SlotState::IdleImplementations§
Source§impl DoubleBufferedSubmitter
impl DoubleBufferedSubmitter
Sourcepub fn state(&self, slot: BufferSlot) -> SlotState
pub fn state(&self, slot: BufferSlot) -> SlotState
Current state of slot.
Sourcepub fn active_slot(&self) -> BufferSlot
pub fn active_slot(&self) -> BufferSlot
The slot the CPU is currently (or will next) record into.
Sourcepub fn frame_count(&self) -> u64
pub fn frame_count(&self) -> u64
Total number of complete double-buffer cycles (frames) submitted.
Sourcepub fn begin_record(&mut self, slot: BufferSlot) -> bool
pub fn begin_record(&mut self, slot: BufferSlot) -> bool
Begin recording commands into slot.
Returns false if slot is not currently Idle.
Sourcepub fn record(&mut self, slot: BufferSlot, entry: CommandEntry) -> bool
pub fn record(&mut self, slot: BufferSlot, entry: CommandEntry) -> bool
Record a command entry into the active recording slot.
Returns false if slot is not in Recording state.
Sourcepub fn finish_record(&mut self, slot: BufferSlot) -> bool
pub fn finish_record(&mut self, slot: BufferSlot) -> bool
Finish recording for slot.
Returns false if slot is not in Recording state.
Sourcepub fn submit(&mut self, slot: BufferSlot) -> Option<Vec<CommandEntry>>
pub fn submit(&mut self, slot: BufferSlot) -> Option<Vec<CommandEntry>>
Submit the commands in slot to the (simulated) GPU queue.
Returns the submitted commands on success, or None if slot is not
ReadyToSubmit.
Sourcepub fn mark_retired(&mut self, slot: BufferSlot) -> bool
pub fn mark_retired(&mut self, slot: BufferSlot) -> bool
Mark slot as retired (GPU execution complete).
Returns false if slot is not Inflight.
Sourcepub fn reset_slot(&mut self, slot: BufferSlot) -> bool
pub fn reset_slot(&mut self, slot: BufferSlot) -> bool
Reset slot to Idle so it can be recorded into again.
Returns false if slot is not Retired.
Sourcepub fn command_count(&self, slot: BufferSlot) -> usize
pub fn command_count(&self, slot: BufferSlot) -> usize
Number of commands recorded in slot.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DoubleBufferedSubmitter
impl RefUnwindSafe for DoubleBufferedSubmitter
impl Send for DoubleBufferedSubmitter
impl Sync for DoubleBufferedSubmitter
impl Unpin for DoubleBufferedSubmitter
impl UnsafeUnpin for DoubleBufferedSubmitter
impl UnwindSafe for DoubleBufferedSubmitter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more