Struct wgpu::TlasPackage

source ·
pub struct TlasPackage { /* private fields */ }
Expand description

The safe version of TlasEntry, containing TlasInstances instead of a raw buffer.

Implementations§

source§

impl TlasPackage

source

pub fn new(tlas: Tlas) -> Self

Construct TlasPackage consuming the Tlas (prevents modification of the Tlas without using this package).

source

pub fn new_with_instances( tlas: Tlas, instances: Vec<Option<TlasInstance>> ) -> Self

Construct TlasPackage consuming the Tlas (prevents modification of the Tlas without using this package). This constructor moves the instances into the package (the number of instances needs to fit into tlas, otherwise when building a validation error will be raised).

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

source

pub fn tlas(&self) -> &Tlas

Get a reference to the underling Tlas.

Trait Implementations§

source§

impl Index<Range<usize>> for TlasPackage

§

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 TlasPackage

§

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 TlasPackage

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 TlasPackage

source§

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

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

Auto Trait Implementations§

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> 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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

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