ComputeBundleBuilder

Struct ComputeBundleBuilder 

Source
pub struct ComputeBundleBuilder<'a, R: Resolver = StandardResolver> {
    pub label: Option<&'a str>,
    pub bind_group_layouts: Vec<&'a BindGroupLayoutDescriptor<'a>>,
    pub pipeline_compile_options: PipelineCompilationOptions<'a>,
    pub entry_point: Option<&'a str>,
    pub main_shader: Option<ModulePath>,
    pub wesl_compile_options: CompileOptions,
    pub resolver: Option<R>,
    pub mangler: Box<dyn Mangler + Send + Sync + 'static>,
    pub workgroup_size: Option<u32>,
}
Expand description

Fields§

§label: Option<&'a str>§bind_group_layouts: Vec<&'a BindGroupLayoutDescriptor<'a>>§pipeline_compile_options: PipelineCompilationOptions<'a>§entry_point: Option<&'a str>§main_shader: Option<ModulePath>§wesl_compile_options: CompileOptions§resolver: Option<R>§mangler: Box<dyn Mangler + Send + Sync + 'static>§workgroup_size: Option<u32>

Implementations§

Source§

impl ComputeBundleBuilder<'_>

Source

pub fn new() -> Self

Create a new compute bundle builder.

Source§

impl<'a, R: Resolver> ComputeBundleBuilder<'a, R>

Source

pub fn label(self, label: impl Into<&'a str>) -> Self

Set the label of the compute bundle.

Source

pub fn bind_group_layout( self, bind_group_layout: &'a BindGroupLayoutDescriptor<'a>, ) -> Self

Source

pub fn bind_group_layouts( self, bind_group_layouts: impl IntoIterator<Item = &'a BindGroupLayoutDescriptor<'a>>, ) -> Self

Source

pub fn pipeline_compile_options( self, compilation_options: PipelineCompilationOptions<'a>, ) -> Self

Source

pub fn entry_point(self, main: &'a str) -> Self

Set the entry point of the compute shader.

This should be the function name of the entry point in the compute shader, which is passed into wgpu::ComputePipelineDescriptor::entry_point.

Source

pub fn main_shader(self, main: ModulePath) -> ComputeBundleBuilder<'a, R>

Set the main shader of the compute bundle.

The shader is required to have an overridable variable workgroup_size of u32, which is set to the workgroup size of at the entry point of the compute pipeline.

Source

pub fn wesl_compile_options(self, options: CompileOptions) -> Self

Source

pub fn resolver<S: Resolver>(self, resolver: S) -> ComputeBundleBuilder<'a, S>

Set the wesl::Resolver.

Source

pub fn mangler( self, mangler: impl Mangler + Send + Sync + 'static, ) -> ComputeBundleBuilder<'a, R>

Set the wesl::Mangler.

Source

pub fn workgroup_size(self, workgroup_size: u32) -> Self

Set the workgroup size.

Source

pub fn build<'b>( self, device: &Device, resources: impl IntoIterator<Item = impl IntoIterator<Item = BindingResource<'a>>>, ) -> Result<ComputeBundle<BindGroup>, ComputeBundleBuildError>

Build the compute bundle with bindings.

Source

pub fn build_without_bind_groups( self, device: &Device, ) -> Result<ComputeBundle<()>, ComputeBundleBuildError>

Build the compute bundle without bind groups.

Trait Implementations§

Source§

impl Default for ComputeBundleBuilder<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, R> Freeze for ComputeBundleBuilder<'a, R>
where R: Freeze,

§

impl<'a, R = StandardResolver> !RefUnwindSafe for ComputeBundleBuilder<'a, R>

§

impl<'a, R> Send for ComputeBundleBuilder<'a, R>
where R: Send,

§

impl<'a, R> Sync for ComputeBundleBuilder<'a, R>
where R: Sync,

§

impl<'a, R> Unpin for ComputeBundleBuilder<'a, R>
where R: Unpin,

§

impl<'a, R = StandardResolver> !UnwindSafe for ComputeBundleBuilder<'a, R>

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

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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