pub struct AdjacencyGpu {
pub buffer: Buffer,
pub max_neighbors: u32,
pub radius: f32,
/* private fields */
}Expand description
GPU resources for adjacency buffer management.
Fields§
§buffer: BufferThe adjacency buffer. Layout per particle: [count: u32, neighbor_indices: array<u32, max_neighbors>] Total stride: (1 + max_neighbors) * 4 bytes
max_neighbors: u32Maximum neighbors per particle.
radius: f32Radius for neighbor detection.
Implementations§
Source§impl AdjacencyGpu
impl AdjacencyGpu
Sourcepub fn new(
device: &Device,
particle_buffer: &Buffer,
spatial: &SpatialGpu,
num_particles: u32,
max_neighbors: u32,
radius: f32,
particle_stride: usize,
) -> Self
pub fn new( device: &Device, particle_buffer: &Buffer, spatial: &SpatialGpu, num_particles: u32, max_neighbors: u32, radius: f32, particle_stride: usize, ) -> Self
Create a new adjacency buffer system.
§Arguments
device- The wgpu deviceparticle_buffer- Buffer containing particle dataspatial- Spatial hashing system for neighbor queriesnum_particles- Number of particlesmax_neighbors- Maximum neighbors to store per particleradius- Radius for neighbor detectionparticle_stride- Byte stride of each particle in the buffer
Sourcepub fn execute(&self, encoder: &mut CommandEncoder)
pub fn execute(&self, encoder: &mut CommandEncoder)
Execute the adjacency computation pass.
This should be called after spatial hashing is executed but before the main particle compute shader.
Sourcepub fn stride_u32(&self) -> u32
pub fn stride_u32(&self) -> u32
Get the stride (in u32s) for each particle’s adjacency data.
Auto Trait Implementations§
impl Freeze for AdjacencyGpu
impl !RefUnwindSafe for AdjacencyGpu
impl Send for AdjacencyGpu
impl Sync for AdjacencyGpu
impl Unpin for AdjacencyGpu
impl !UnwindSafe for AdjacencyGpu
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> 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.