pub enum Handle<BL = MaybeDynMemLayout> {
Opaque(Type),
Buffer(AddrSpace, BL),
}
Expand description
“Abstract resource” handle, that can be found in non-memory GlobalVar
s.
This largely corresponds to the Vulkan concept of a “descriptor”, and arrays
of handles (e.g. GlobalVarShape::Handles
with fixed_count != Some(1)
)
map to the “descriptor indexing” usecase.
Variants§
Opaque(Type)
Fully opaque resources (e.g. samplers, images).
Buffer(AddrSpace, BL)
Buffer resources, describing ranges of (technically) untyped memory in
some address space (e.g. Uniform
, StorageBuffer
), but being limited
by SPIR-V logical addressing (unlike e.g. PhysicalStorageBuffer
).
SPIR-V makes this particularly painful, through a couple of design flaws:
- forcing a static type (for the buffer contents) and disallowing any
pointer casts, despite the fact that any plausible representation for
“logical pointer into a buffer” (e.g.
(BufferDescriptor, Offset)
) must be fundamentally untyped (as it must allow access to relatively large amounts of memory, and also support dynamic array indexing), even when not a “GPU memory address” (likePhysicalStorageBuffer
) - encoding the buffer type using a (GLSL-style) “interface block”, where
instead of a special type (or a pointer with the right storage class),
an
OpTypeStruct
(having the statically typed buffer contents as fields) with theBlock
decoration is used, and then this “interface block” type can be further nested inOpTypeArray
orOpTypeRuntimeArray
to allow descriptor indexing - which leads to constructs like a GLSLbuffer { uint data[]; } bufs[];
being encoded with two levels ofOpTypeRuntimeArray
, separated not by any explicit indirection, but only by theBlock
decoration on theOpTypeStruct
forbuffer {...}
Trait Implementations§
impl<BL: Copy> Copy for Handle<BL>
impl<BL: Eq> Eq for Handle<BL>
impl<BL> StructuralPartialEq for Handle<BL>
Auto Trait Implementations§
impl<BL> Freeze for Handle<BL>where
BL: Freeze,
impl<BL> RefUnwindSafe for Handle<BL>where
BL: RefUnwindSafe,
impl<BL> Send for Handle<BL>where
BL: Send,
impl<BL> Sync for Handle<BL>where
BL: Sync,
impl<BL> Unpin for Handle<BL>where
BL: Unpin,
impl<BL> UnwindSafe for Handle<BL>where
BL: UnwindSafe,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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