pub struct CommandBuffer { /* private fields */ }Expand description
A GPU command buffer that records and submits work to the GPU.
Implementations§
Source§impl CommandBuffer
impl CommandBuffer
Sourcepub fn new(label: impl Into<String>) -> Self
pub fn new(label: impl Into<String>) -> Self
Create a new, empty command buffer in the Recording state.
Sourcepub fn record(&mut self, entry: CommandEntry)
pub fn record(&mut self, entry: CommandEntry)
Sourcepub fn finish(&mut self) -> bool
pub fn finish(&mut self) -> bool
Finish recording and transition the buffer to Executable.
Returns false if the buffer was not in Recording state.
Sourcepub fn submit(&mut self) -> Option<Vec<CommandEntry>>
pub fn submit(&mut self) -> Option<Vec<CommandEntry>>
Simulate submission to the GPU queue.
Returns the list of submitted commands (for testing / inspection) and
transitions the buffer to Pending.
Returns None if the buffer is not Executable.
Sourcepub fn begin(&mut self) -> bool
pub fn begin(&mut self) -> bool
Begin a fresh recording pass after a reset.
Returns false if the buffer was not in Reset state.
Sourcepub fn command_count(&self) -> usize
pub fn command_count(&self) -> usize
Number of recorded commands.
Sourcepub fn state(&self) -> CommandBufferState
pub fn state(&self) -> CommandBufferState
Current state of the buffer.
Sourcepub fn total_estimated_cost(&self) -> f32
pub fn total_estimated_cost(&self) -> f32
Total estimated GPU cost of all recorded commands.
Auto Trait Implementations§
impl Freeze for CommandBuffer
impl RefUnwindSafe for CommandBuffer
impl Send for CommandBuffer
impl Sync for CommandBuffer
impl Unpin for CommandBuffer
impl UnsafeUnpin for CommandBuffer
impl UnwindSafe for CommandBuffer
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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