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
impl CommandBuffer
Sourcepub fn dispatch(
&mut self,
pipeline: &Pipeline,
args: &[Arg<'_>],
threads: usize,
) -> Result<()>
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.
Sourcepub fn dispatch_groups(
&mut self,
pipeline: &Pipeline,
args: &[Arg<'_>],
groups: [usize; 3],
threads: [usize; 3],
) -> Result<()>
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).
Sourcepub fn dispatch_threads(
&mut self,
pipeline: &Pipeline,
args: &[Arg<'_>],
grid: [usize; 3],
group: [usize; 3],
) -> Result<()>
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).
Sourcepub fn commit_then(
self,
on_complete: impl FnOnce(Result<()>) + Send + 'static,
) -> Pending
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.