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§
source§impl<BL: PartialEq> PartialEq<Handle<BL>> for Handle<BL>
impl<BL: PartialEq> PartialEq<Handle<BL>> for Handle<BL>
impl<BL: Copy> Copy for Handle<BL>
impl<BL: Eq> Eq for Handle<BL>
impl<BL> StructuralEq for Handle<BL>
impl<BL> StructuralPartialEq for Handle<BL>
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.