wgpu

Struct Blas

Source
pub struct Blas {
    pub(crate) handle: Option<u64>,
    pub(crate) inner: DispatchBlas,
}
Expand description

Bottom Level Acceleration Structure (BLAS).

A BLAS is a device-specific raytracing acceleration structure that contains geometry data.

These BLASes are combined with transform in a TlasInstance to create a Tlas.

Fields§

§handle: Option<u64>§inner: DispatchBlas

Implementations§

Source§

impl Blas

Source

pub fn handle(&self) -> Option<u64>

Raw handle to the acceleration structure, used inside raw instance buffers.

Source

pub unsafe fn as_hal<A: HalApi>( &mut self, ) -> Option<impl Deref<Target = A::AccelerationStructure> + WasmNotSendSync>

Available on wgpu_core only.

Get the wgpu_hal acceleration structure from this Blas.

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 or custom 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.
Source

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

Available on custom only.

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

Source§

impl Blas

Source

pub fn prepare_compaction_async( &self, callback: impl FnOnce(Result<(), BlasAsyncError>) + WasmNotSend + 'static, )

Asynchronously prepares this BLAS for compaction. The callback is called once all builds using this BLAS are finished and the BLAS is compactable. This can be checked using Blas::ready_for_compaction. Rebuilding this BLAS will reset its compacted state, and it will need to be prepared again.

§Interaction with other functions

On native, queue.submit(..) and polling devices (that is calling instance.poll_all or device.poll) with PollType::Poll may call the callback. On native, polling devices with PollType::Wait (or PollType::WaitForSubmissionIndex with a submission index greater than the last submit the BLAS was used in) will guarantee callback is called.

Source

pub fn ready_for_compaction(&self) -> bool

Checks whether this BLAS is ready for compaction. The returned value is true if Blas::prepare_compaction_async’s callback was called with a non-error value, otherwise this is false.

Trait Implementations§

Source§

impl Clone for Blas

Source§

fn clone(&self) -> Blas

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 Blas

Source§

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

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

impl Hash for Blas

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 Ord for Blas

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 Blas

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 Blas

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 Blas

Auto Trait Implementations§

§

impl Freeze for Blas

§

impl !RefUnwindSafe for Blas

§

impl Send for Blas

§

impl Sync for Blas

§

impl Unpin for Blas

§

impl !UnwindSafe for Blas

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,