#[repr(transparent)]pub struct GpuBufferHandle(u32);Expand description
GpuBuffer handle is similar to GpuBufferAddress with additional checks to avoid accidentally using the same handle in multiple frames.
Do not send GpuBufferHandle to the GPU directly. Instead use a GpuBuffer or GpuBufferBuilder to resolve the handle into a GpuBufferAddress that can be placed into GPU data.
The extra checks consists into storing an 8 bit epoch in the upper 8 bits of the handle. The epoch will be reused every 255 frames so this is not a mechanism that one can rely on to store and reuse handles over multiple frames. It is only a mechanism to catch mistakes where a handle is accidentally used in the wrong frame and panic.
Tuple Fields§
§0: u32Implementations§
Source§impl GpuBufferHandle
impl GpuBufferHandle
pub const INVALID: GpuBufferHandle
const EPOCH_MASK: u32 = 0xFC000000
fn new(addr: u32, epoch: u32) -> Self
pub fn address_unchecked(&self) -> GpuBufferAddress
Trait Implementations§
Source§impl Clone for GpuBufferHandle
impl Clone for GpuBufferHandle
Source§fn clone(&self) -> GpuBufferHandle
fn clone(&self) -> GpuBufferHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GpuBufferHandle
impl Debug for GpuBufferHandle
Source§impl MallocSizeOf for GpuBufferHandle
impl MallocSizeOf for GpuBufferHandle
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Source§impl PartialEq for GpuBufferHandle
impl PartialEq for GpuBufferHandle
Source§impl Serialize for GpuBufferHandle
impl Serialize for GpuBufferHandle
impl Copy for GpuBufferHandle
impl Eq for GpuBufferHandle
impl StructuralPartialEq for GpuBufferHandle
Auto Trait Implementations§
impl Freeze for GpuBufferHandle
impl RefUnwindSafe for GpuBufferHandle
impl Send for GpuBufferHandle
impl Sync for GpuBufferHandle
impl Unpin for GpuBufferHandle
impl UnsafeUnpin for GpuBufferHandle
impl UnwindSafe for GpuBufferHandle
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more