pub struct WorkgroupSize {
pub x: u32,
pub y: u32,
pub z: u32,
}Expand description
Computes optimal workgroup sizes for dispatch, respecting hardware limits.
Fields§
§x: u32Local size X.
y: u32Local size Y.
z: u32Local size Z.
Implementations§
Source§impl WorkgroupSize
impl WorkgroupSize
Sourcepub fn total_invocations(&self) -> u32
pub fn total_invocations(&self) -> u32
Total number of invocations per workgroup.
Sourcepub fn auto_fit_1d(total_elements: u32, max_invocations: u32) -> Self
pub fn auto_fit_1d(total_elements: u32, max_invocations: u32) -> Self
Auto-fit a 1D workgroup to a total element count, clamped to hardware max.
Sourcepub fn auto_fit_2d(width: u32, height: u32, max_invocations: u32) -> Self
pub fn auto_fit_2d(width: u32, height: u32, max_invocations: u32) -> Self
Auto-fit a 2D workgroup to a width x height, clamped to limits.
Sourcepub fn dispatch_count_1d(&self, total: u32) -> u32
pub fn dispatch_count_1d(&self, total: u32) -> u32
Compute the number of workgroups needed to cover total elements in 1D.
Sourcepub fn dispatch_count_2d(&self, width: u32, height: u32) -> (u32, u32)
pub fn dispatch_count_2d(&self, width: u32, height: u32) -> (u32, u32)
Compute the number of workgroups needed to cover (width, height) in 2D.
Sourcepub fn dispatch_count_3d(&self, w: u32, h: u32, d: u32) -> (u32, u32, u32)
pub fn dispatch_count_3d(&self, w: u32, h: u32, d: u32) -> (u32, u32, u32)
Compute dispatch counts for 3D.
Sourcepub fn query_limits(gl: &Context) -> WorkgroupLimits
pub fn query_limits(gl: &Context) -> WorkgroupLimits
Query hardware limits from GL context.
Trait Implementations§
Source§impl Clone for WorkgroupSize
impl Clone for WorkgroupSize
Source§fn clone(&self) -> WorkgroupSize
fn clone(&self) -> WorkgroupSize
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 moreSource§impl Debug for WorkgroupSize
impl Debug for WorkgroupSize
impl Copy for WorkgroupSize
Auto Trait Implementations§
impl Freeze for WorkgroupSize
impl RefUnwindSafe for WorkgroupSize
impl Send for WorkgroupSize
impl Sync for WorkgroupSize
impl Unpin for WorkgroupSize
impl UnsafeUnpin for WorkgroupSize
impl UnwindSafe for WorkgroupSize
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.