Enum spirt::qptr::shapes::Handle

source ·
pub enum Handle<BL = MaybeDynMemLayout> {
    Opaque(Type),
    Buffer(AddrSpace, BL),
}
Expand description

“Abstract resource” handle, that can be found in non-memory GlobalVars.

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” (like PhysicalStorageBuffer)
  • 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 the Block decoration is used, and then this “interface block” type can be further nested in OpTypeArray or OpTypeRuntimeArray to allow descriptor indexing - which leads to constructs like a GLSL buffer { uint data[]; } bufs[]; being encoded with two levels of OpTypeRuntimeArray, separated not by any explicit indirection, but only by the Block decoration on the OpTypeStruct for buffer {...}

Trait Implementations§

source§

impl<BL: Clone> Clone for Handle<BL>

source§

fn clone(&self) -> Handle<BL>

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<BL: Hash> Hash for Handle<BL>

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<BL: PartialEq> PartialEq<Handle<BL>> for Handle<BL>

source§

fn eq(&self, other: &Handle<BL>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<BL: Copy> Copy for Handle<BL>

source§

impl<BL: Eq> Eq for Handle<BL>

source§

impl<BL> StructuralEq for Handle<BL>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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,

source§

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,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.