Struct PipelineAsync

Source
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>

Source

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.

Source

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.

Source

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>
where Input: Send, Uniform: Send, Output: Send,

§

impl<'a, Input, Uniform, Output, const N: usize> Sync for PipelineAsync<'a, Input, Uniform, Output, N>
where Input: Sync, Uniform: Sync, Output: Sync,

§

impl<'a, Input, Uniform, Output, const N: usize> Unpin for PipelineAsync<'a, Input, Uniform, Output, N>
where Input: Unpin, Uniform: Unpin, Output: Unpin,

§

impl<'a, Input, Uniform, Output, const N: usize> !UnwindSafe for PipelineAsync<'a, Input, Uniform, Output, N>

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> 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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,