pub struct PipelineAsync<'a, Input: Pod, Uniform: Pod, Output: Pod, const N: usize> { /* private fields */ }
Expand description
This struct represents a pipeline. It is used to run async compute shaders. To build it use the gen_pipeline
method of the GpuComputeAsync
struct.
Implementations§
Source§impl<'a, Input: Pod, Uniform: Pod, Output: Pod, const N: usize> PipelineAsync<'a, Input, Uniform, Output, N>
impl<'a, Input: Pod, Uniform: Pod, Output: Pod, const N: usize> PipelineAsync<'a, Input, Uniform, Output, N>
Sourcepub fn write_uniform(&mut self, uniform: &Uniform)
pub fn write_uniform(&mut self, uniform: &Uniform)
This method is used to write the uniform buffer. It is useful to change the uniform between runs.
Sourcepub fn dbg_print_scratchpad<T: Pod + AnyBitPattern + Debug>(&mut self)
pub fn dbg_print_scratchpad<T: Pod + AnyBitPattern + Debug>(&mut self)
This method is used to print the content of the scratchpad buffer. It is useful for debugging.
Sourcepub async fn run<T: Send + 'static>(
&mut self,
input: &Input,
workgroups: [(u32, u32, u32); N],
callback: impl FnOnce(&Output) -> T + Send,
) -> T
pub async fn run<T: Send + 'static>( &mut self, input: &Input, workgroups: [(u32, u32, u32); N], callback: impl FnOnce(&Output) -> T + Send, ) -> T
This method is used to run the pipeline. It takes the input buffer, the workgroups and a callback. The callback is used to convert the output buffer to the desired type. It is useful to avoid copying the output buffer.
If you want to extract the result you can use a callback like |vals: &[u32; N_ELEMENT]| *vals
and the type of return of the callback will be returned as the return of the run
function.
Auto Trait Implementations§
impl<'a, Input, Uniform, Output, const N: usize> !Freeze for PipelineAsync<'a, Input, Uniform, Output, N>
impl<'a, Input, Uniform, Output, const N: usize> !RefUnwindSafe for PipelineAsync<'a, Input, Uniform, Output, N>
impl<'a, Input, Uniform, Output, const N: usize> Send for PipelineAsync<'a, Input, Uniform, Output, N>
impl<'a, Input, Uniform, Output, const N: usize> Sync for PipelineAsync<'a, Input, Uniform, Output, N>
impl<'a, Input, Uniform, Output, const N: usize> Unpin for PipelineAsync<'a, Input, Uniform, Output, N>
impl<'a, Input, Uniform, Output, const N: usize> !UnwindSafe for PipelineAsync<'a, Input, Uniform, Output, N>
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