pub struct ComputePipeline {
pub label: String,
pub shader_source: String,
pub entry_point: String,
pub workgroup_size: [u32; 3],
}Expand description
GPU compute pipeline descriptor (wgpu-agnostic, usable in unit tests).
Fields§
§label: StringHuman-readable label for debugging.
shader_source: StringRaw WGSL shader source.
entry_point: StringName of the entry-point function inside the shader.
workgroup_size: [u32; 3]Workgroup size declared in the shader [X, Y, Z].
Implementations§
Source§impl ComputePipeline
impl ComputePipeline
Sourcepub fn new(label: &str, shader: &str, entry_point: &str) -> Self
pub fn new(label: &str, shader: &str, entry_point: &str) -> Self
Create a new pipeline descriptor.
workgroup_size defaults to [64, 1, 1] (matching the shaders in
crate::shaders).
Sourcepub fn workgroups_needed(&self, n_items: u32) -> [u32; 3]
pub fn workgroups_needed(&self, n_items: u32) -> [u32; 3]
Compute the dispatch grid dimensions needed to cover n_items work
items.
Returns [ceil(n_items / workgroup_size[0\]), 1, 1].
Trait Implementations§
Source§impl Clone for ComputePipeline
impl Clone for ComputePipeline
Source§fn clone(&self) -> ComputePipeline
fn clone(&self) -> ComputePipeline
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ComputePipeline
impl RefUnwindSafe for ComputePipeline
impl Send for ComputePipeline
impl Sync for ComputePipeline
impl Unpin for ComputePipeline
impl UnsafeUnpin for ComputePipeline
impl UnwindSafe for ComputePipeline
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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