Skip to main content

CommandBuffer

Struct CommandBuffer 

Source
pub struct CommandBuffer { /* private fields */ }
Expand description

Work being recorded for the GPU: one concurrent compute encoder, with memory barriers inserted only where a dispatch depends on an earlier one.

Implementations§

Source§

impl CommandBuffer

Source

pub fn dispatch( &mut self, pipeline: &Pipeline, args: &[Arg<'_>], threads: usize, ) -> Result<()>

Encodes pipeline over threads threads (a 1-D grid) with args bound to slots 0..args.len(). The threadgroup size is derived from the pipeline’s limits.

Source

pub fn dispatch_groups( &mut self, pipeline: &Pipeline, args: &[Arg<'_>], groups: [usize; 3], threads: [usize; 3], ) -> Result<()>

Encodes pipeline over a grid of groups threadgroups of threads threads each, for kernels that cooperate within a threadgroup (reductions, tiled matrix products).

Source

pub fn dispatch_threads( &mut self, pipeline: &Pipeline, args: &[Arg<'_>], grid: [usize; 3], group: [usize; 3], ) -> Result<()>

Encodes pipeline over exactly grid threads in up to three dimensions, in threadgroups of group threads (the edge threadgroups are partial).

Source

pub fn barriers(&self) -> usize

Memory barriers inserted so far.

Source

pub fn commit(self) -> Submitted

Submits the work to the GPU.

Source

pub fn commit_then( self, on_complete: impl FnOnce(Result<()>) + Send + 'static, ) -> Pending

Submits the work and returns at once. on_complete runs exactly once with the command buffer’s result: on a Metal thread when the GPU finishes, or earlier on the thread that calls Pending::wait.

Trait Implementations§

Source§

impl Drop for CommandBuffer

Source§

fn drop(&mut self)

Abandoned work is never submitted; release the buffers’ guards.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.