pub struct GpuSdfMultiDispatch {
pub batches: Vec<GpuSdfInstancedBatch>,
}Expand description
Multi-SDF dispatch — groups queries by SDF for the minimum number of GPU
kernel calls per frame (one dispatch per unique sdf_id).
§Usage
use alice_physics::gpu_sdf::{GpuSdfMultiDispatch, GpuSdfQuery};
let mut dispatch = GpuSdfMultiDispatch::new();
let sphere_queries = vec![GpuSdfQuery { x: 0.0, y: 0.0, z: 0.0, radius: 0.5 }];
let box_queries = vec![GpuSdfQuery { x: 1.0, y: 1.0, z: 1.0, radius: 0.0 }];
dispatch.add_batch(0, sphere_queries);
dispatch.add_batch(1, box_queries);
assert_eq!(dispatch.total_queries(), 2);
assert_eq!(dispatch.total_dispatches(), 2);Fields§
§batches: Vec<GpuSdfInstancedBatch>One entry per unique SDF — ordered by insertion.
Implementations§
Source§impl GpuSdfMultiDispatch
impl GpuSdfMultiDispatch
Sourcepub fn add_batch(&mut self, sdf_id: u32, queries: Vec<GpuSdfQuery>)
pub fn add_batch(&mut self, sdf_id: u32, queries: Vec<GpuSdfQuery>)
Append a batch of queries for a single SDF.
sdf_id identifies which GPU-side SDF buffer to bind during this
dispatch. Queries for an sdf_id that already has a batch are appended
to it (in call order), so there is one batch, and one dispatch, per
unique sdf_id; batches keep the order of their first add_batch.
Sourcepub fn total_queries(&self) -> usize
pub fn total_queries(&self) -> usize
Total number of individual SDF point queries across all batches.
Sourcepub fn total_dispatches(&self) -> usize
pub fn total_dispatches(&self) -> usize
Number of GPU kernel dispatches that will be issued (one per batch, so
one per unique sdf_id).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpuSdfMultiDispatch
impl RefUnwindSafe for GpuSdfMultiDispatch
impl Send for GpuSdfMultiDispatch
impl Sync for GpuSdfMultiDispatch
impl Unpin for GpuSdfMultiDispatch
impl UnsafeUnpin for GpuSdfMultiDispatch
impl UnwindSafe for GpuSdfMultiDispatch
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> 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