pub struct WGSLComputeKernel {
pub params: WGSLComputeKernelParams,
pub bindings: Vec<WGSLBinding>,
pub shared_vars: Vec<WGSLGlobal>,
pub body: Vec<WGSLStatement>,
}Expand description
High-level compute kernel builder.
Fields§
§params: WGSLComputeKernelParamsKernel parameters.
bindings: Vec<WGSLBinding>Bindings used by this kernel.
Shared (workgroup) memory declarations.
body: Vec<WGSLStatement>Body statements.
Implementations§
Source§impl WGSLComputeKernel
impl WGSLComputeKernel
Sourcepub fn new(name: impl Into<String>, wg_x: u32, wg_y: u32, wg_z: u32) -> Self
pub fn new(name: impl Into<String>, wg_x: u32, wg_y: u32, wg_z: u32) -> Self
Create a new compute kernel.
Sourcepub fn push(&mut self, stmt: WGSLStatement)
pub fn push(&mut self, stmt: WGSLStatement)
Add a body statement.
Add a workgroup-shared array.
Sourcepub fn emit_function(&self) -> WGSLFunction
pub fn emit_function(&self) -> WGSLFunction
Emit the kernel as a WGSLFunction ready to be added to a shader.
Sourcepub fn emit_shader(&self) -> String
pub fn emit_shader(&self) -> String
Emit the kernel as a complete WGSL shader module.
Trait Implementations§
Source§impl Debug for WGSLComputeKernel
impl Debug for WGSLComputeKernel
Source§impl Default for WGSLComputeKernel
impl Default for WGSLComputeKernel
Source§fn default() -> WGSLComputeKernel
fn default() -> WGSLComputeKernel
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WGSLComputeKernel
impl RefUnwindSafe for WGSLComputeKernel
impl Send for WGSLComputeKernel
impl Sync for WGSLComputeKernel
impl Unpin for WGSLComputeKernel
impl UnsafeUnpin for WGSLComputeKernel
impl UnwindSafe for WGSLComputeKernel
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