pub struct Tlas {
pub(crate) inner: DispatchTlas,
pub(crate) instances: Vec<Option<TlasInstance>>,
pub(crate) lowest_unmodified: u32,
}
Expand description
Top Level Acceleration Structure (TLAS).
A TLAS contains a series of TLAS instances, which are a reference to a BLAS and a transformation matrix placing the geometry in the world.
A TLAS also contains an extra set of TLAS instances in a device readable form, you cant interact directly with these, instead you have to build the TLAS with TLAS instances.
Fields§
§inner: DispatchTlas
§instances: Vec<Option<TlasInstance>>
§lowest_unmodified: u32
Implementations§
Source§impl Tlas
impl Tlas
Sourcepub unsafe fn as_hal<A: HalApi, F: FnOnce(Option<&A::AccelerationStructure>) -> R, R>(
&mut self,
hal_tlas_callback: F,
) -> R
Available on wgpu_core
only.
pub unsafe fn as_hal<A: HalApi, F: FnOnce(Option<&A::AccelerationStructure>) -> R, R>( &mut self, hal_tlas_callback: F, ) -> R
wgpu_core
only.Returns the inner hal Acceleration Structure using a callback. The hal acceleration structure
will be None
if the backend type argument does not match with this wgpu Tlas
This method will start the wgpu_core level command recording.
§Safety
- The raw handle obtained from the hal Acceleration Structure must not be manually destroyed
- If the raw handle is build,
Sourcepub fn as_custom<T: TlasInterface>(&self) -> Option<&T>
Available on custom
only.
pub fn as_custom<T: TlasInterface>(&self) -> Option<&T>
custom
only.Returns custom implementation of Tlas (if custom backend and is internally T)
Sourcepub fn get(&self) -> &[Option<TlasInstance>]
pub fn get(&self) -> &[Option<TlasInstance>]
Get a reference to all instances.
Sourcepub fn get_mut_slice(
&mut self,
range: Range<usize>,
) -> Option<&mut [Option<TlasInstance>]>
pub fn get_mut_slice( &mut self, range: Range<usize>, ) -> Option<&mut [Option<TlasInstance>]>
Get a mutable slice to a range of instances.
Returns None if the range is out of bounds.
All elements from the lowest accessed index up are marked as modified.
For best performance it is recommended to prefer access to low elements and modify higher elements as little as possible.
This can be done by ordering instances from the most to the least used. It is recommended
to use Self::index_mut
unless the option if out of bounds is required
Sourcepub fn get_mut_single(
&mut self,
index: usize,
) -> Option<&mut Option<TlasInstance>>
pub fn get_mut_single( &mut self, index: usize, ) -> Option<&mut Option<TlasInstance>>
Get a single mutable reference to an instance.
Returns None if the range is out of bounds.
All elements from the lowest accessed index up are marked as modified.
For best performance it is recommended to prefer access to low elements and modify higher elements as little as possible.
This can be done by ordering instances from the most to the least used. It is recommended
to use Self::index_mut
unless the option if out of bounds is required
Sourcepub fn as_binding(&self) -> BindingResource<'_>
pub fn as_binding(&self) -> BindingResource<'_>
Get the binding resource for the underling acceleration structure, to be used when creating a BindGroup
Trait Implementations§
Source§impl Ord for Tlas
impl Ord for Tlas
Source§impl PartialOrd for Tlas
impl PartialOrd for Tlas
impl Eq for Tlas
Auto Trait Implementations§
impl Freeze for Tlas
impl !RefUnwindSafe for Tlas
impl Send for Tlas
impl Sync for Tlas
impl Unpin for Tlas
impl !UnwindSafe for Tlas
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.