wgpu::api::tlas

Struct Tlas

Source
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

Source

pub 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.

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,
Source

pub fn as_custom<T: TlasInterface>(&self) -> Option<&T>

Available on custom only.

Returns custom implementation of Tlas (if custom backend and is internally T)

Source

pub fn get(&self) -> &[Option<TlasInstance>]

Get a reference to all instances.

Source

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

Source

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

Source

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 Clone for Tlas

Source§

fn clone(&self) -> Tlas

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Tlas

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Tlas

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<Range<usize>> for Tlas

Source§

type Output = [Option<TlasInstance>]

The returned type after indexing.
Source§

fn index(&self, index: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for Tlas

Source§

type Output = Option<TlasInstance>

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<Range<usize>> for Tlas

Source§

fn index_mut(&mut self, index: Range<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl IndexMut<usize> for Tlas

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl Ord for Tlas

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Tlas

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Tlas

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

Source§

impl<T> CommonTraits for T
where T: AsAny + Any + Debug + WasmNotSendSync,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,