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
A builder for ComputeBundle.
The shader is compiled using the WESL compiler,
The following fields should be set before calling ComputeBundleBuilder::build or
ComputeBundleBuilder::build_without_bind_groups:
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<'_>
impl ComputeBundleBuilder<'_>
Source§impl<'a, R: Resolver> ComputeBundleBuilder<'a, R>
impl<'a, R: Resolver> ComputeBundleBuilder<'a, R>
Sourcepub fn bind_group_layout(
self,
bind_group_layout: &'a BindGroupLayoutDescriptor<'a>,
) -> Self
pub fn bind_group_layout( self, bind_group_layout: &'a BindGroupLayoutDescriptor<'a>, ) -> Self
Sourcepub fn bind_group_layouts(
self,
bind_group_layouts: impl IntoIterator<Item = &'a BindGroupLayoutDescriptor<'a>>,
) -> Self
pub fn bind_group_layouts( self, bind_group_layouts: impl IntoIterator<Item = &'a BindGroupLayoutDescriptor<'a>>, ) -> Self
Sourcepub fn pipeline_compile_options(
self,
compilation_options: PipelineCompilationOptions<'a>,
) -> Self
pub fn pipeline_compile_options( self, compilation_options: PipelineCompilationOptions<'a>, ) -> Self
Set the wgpu::PipelineCompilationOptions.
Sourcepub fn entry_point(self, main: &'a str) -> Self
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.
Sourcepub fn main_shader(self, main: ModulePath) -> ComputeBundleBuilder<'a, R>
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.
Sourcepub fn wesl_compile_options(self, options: CompileOptions) -> Self
pub fn wesl_compile_options(self, options: CompileOptions) -> Self
Set the wesl::CompileOptions.
Sourcepub fn resolver<S: Resolver>(self, resolver: S) -> ComputeBundleBuilder<'a, S>
pub fn resolver<S: Resolver>(self, resolver: S) -> ComputeBundleBuilder<'a, S>
Set the wesl::Resolver.
Sourcepub fn mangler(
self,
mangler: impl Mangler + Send + Sync + 'static,
) -> ComputeBundleBuilder<'a, R>
pub fn mangler( self, mangler: impl Mangler + Send + Sync + 'static, ) -> ComputeBundleBuilder<'a, R>
Set the wesl::Mangler.
Sourcepub fn workgroup_size(self, workgroup_size: u32) -> Self
pub fn workgroup_size(self, workgroup_size: u32) -> Self
Set the workgroup size.
Sourcepub fn build<'b>(
self,
device: &Device,
resources: impl IntoIterator<Item = impl IntoIterator<Item = BindingResource<'a>>>,
) -> Result<ComputeBundle<BindGroup>, ComputeBundleBuildError>
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.
Sourcepub fn build_without_bind_groups(
self,
device: &Device,
) -> Result<ComputeBundle<()>, ComputeBundleBuildError>
pub fn build_without_bind_groups( self, device: &Device, ) -> Result<ComputeBundle<()>, ComputeBundleBuildError>
Build the compute bundle without bind groups.
Trait Implementations§
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> 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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