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>(
&mut self,
) -> Option<impl Deref<Target = A::AccelerationStructure>>
Available on wgpu_core
only.
pub unsafe fn as_hal<A: HalApi>( &mut self, ) -> Option<impl Deref<Target = A::AccelerationStructure>>
wgpu_core
only.Get the wgpu_hal
acceleration structure from this Tlas
.
Find the Api struct corresponding to the active backend in wgpu_hal::api
,
and pass that struct to the to the A
type parameter.
Returns a guard that dereferences to the type of the hal backend
which implements A::AccelerationStructure
.
§Deadlocks
- The returned guard holds a read-lock on a device-local “destruction”
lock, which will cause all calls to
destroy
to block until the guard is released.
§Errors
This method will return None if:
- The acceleration structure is not from the backend specified by
A
. - The acceleration structure is from the
webgpu
orcustom
backend.
§Safety
- The returned resource must not be destroyed unless the guard is the last reference to it and it is not in use by the GPU. The guard and handle may be dropped at any time however.
- All the safety requirements of wgpu-hal must be upheld.
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.