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
impl Blas
Sourcepub fn handle(&self) -> Option<u64>
pub fn handle(&self) -> Option<u64>
Raw handle to the acceleration structure, used inside raw instance buffers.
Sourcepub unsafe fn as_hal<A: HalApi>(
&mut self,
) -> Option<impl Deref<Target = A::AccelerationStructure> + WasmNotSendSync>
Available on wgpu_core
only.
pub unsafe fn as_hal<A: HalApi>( &mut self, ) -> Option<impl Deref<Target = A::AccelerationStructure> + WasmNotSendSync>
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
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: BlasInterface>(&self) -> Option<&T>
Available on custom
only.
pub fn as_custom<T: BlasInterface>(&self) -> Option<&T>
custom
only.Returns custom implementation of Blas (if custom backend and is internally T)
Source§impl Blas
impl Blas
Sourcepub fn prepare_compaction_async(
&self,
callback: impl FnOnce(Result<(), BlasAsyncError>) + WasmNotSend + 'static,
)
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.
Sourcepub fn ready_for_compaction(&self) -> bool
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 Ord for Blas
impl Ord for Blas
Source§impl PartialOrd for Blas
impl PartialOrd for Blas
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> 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.