enum LocalType {
    Numeric(NumericType),
    Pointer {
        base: Word,
        class: StorageClass,
    },
    Image(LocalImageType),
    SampledImage {
        image_type_id: Word,
    },
    Sampler,
    BindingArray {
        base: Handle<Type>,
        size: u32,
    },
    AccelerationStructure,
    RayQuery,
}Expand description
A SPIR-V type constructed during code generation.
This is the variant of LookupType used to represent types that might not
be available in the arena. Variants are present here for one of two reasons:
- 
They represent types synthesized during code generation, as explained in the documentation for
LookupType. - 
They represent types for which SPIR-V forbids duplicate
OpType...instructions, requiring deduplication. 
This is not a complete copy of TypeInner: for example, SPIR-V generation
never synthesizes new struct types, so LocalType has nothing for that.
Each LocalType variant should be handled identically to its analogous
TypeInner variant. You can use the Writer::localtype_from_inner
function to help with this, by converting everything possible to a
LocalType before inspecting it.
§LocalType equality and SPIR-V OpType uniqueness
The definition of Eq on LocalType is carefully chosen to help us follow
certain SPIR-V rules. SPIR-V §2.8 requires some classes of OpType...
instructions to be unique; for example, you can’t have two OpTypeInt 32 1
instructions in the same module. All 32-bit signed integers must use the
same type id.
All SPIR-V types that must be unique can be represented as a LocalType,
and two LocalTypes are always Eq if SPIR-V would require them to use the
same OpType... instruction. This lets us avoid duplicates by recording the
ids of the type instructions we’ve already generated in a hash table,
Writer::lookup_type, keyed by LocalType.
As another example, LocalImageType, stored in the LocalType::Image
variant, is designed to help us deduplicate OpTypeImage instructions. See
its documentation for details.
SPIR-V does not require pointer types to be unique - but different
SPIR-V ids are considered to be distinct pointer types. Since Naga
uses structural type equality, we need to represent each Naga
equivalence class with a single SPIR-V OpTypePointer.
As it always must, the Hash implementation respects the Eq relation.
Variants§
Numeric(NumericType)
A numeric type.
Pointer
Image(LocalImageType)
SampledImage
Sampler
BindingArray
AccelerationStructure
RayQuery
Trait Implementations§
Source§impl From<LocalType> for LookupType
 
impl From<LocalType> for LookupType
impl Copy for LocalType
impl Eq for LocalType
impl StructuralPartialEq for LocalType
Auto Trait Implementations§
impl Freeze for LocalType
impl RefUnwindSafe for LocalType
impl Send for LocalType
impl Sync for LocalType
impl Unpin for LocalType
impl UnwindSafe for LocalType
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,
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
key and return true if they are equal.