pub struct compute_kernel {
pub x: u32,
pub y: u32,
pub z: u32,
pub code: String,
}
Expand description
for starting your computing mission on gpu first you need to write your kernel code in wgsl (recommended) or any other shader codes which wgpu supports , and then create compute_kernel variable with that code .
x , y , z fields can be used to specify how many blocks of gpu is needed for your work
amounts of threads used = @workgroup_size (which you specify in your shader code) * x * y * z
Fields§
§x: u32
sets number of GPU blocks in x direction
y: u32
sets number of GPU blocks in y direction
z: u32
sets number of GPU blocks in z direction
code: String
the default entry point is set to main function , so your kernel code in wgsl must contain main function
Trait Implementations§
Source§impl Clone for compute_kernel
impl Clone for compute_kernel
Source§fn clone(&self) -> compute_kernel
fn clone(&self) -> compute_kernel
Returns a duplicate of the value. Read more
1.0.0 · 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 compute_kernel
impl RefUnwindSafe for compute_kernel
impl Send for compute_kernel
impl Sync for compute_kernel
impl Unpin for compute_kernel
impl UnwindSafe for compute_kernel
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