fn additional_extensions(module: &Module, inst: &Instruction) -> &'static [&'static str] {
    if inst.class.opcode == Op::Capability {
        let version = module.header.as_ref().unwrap().version();
        match inst.operands[0].unwrap_capability() {
            Capability::VulkanMemoryModel if version < (1, 5) => &["SPV_KHR_vulkan_memory_model"],
            Capability::RuntimeDescriptorArray if version < (1, 5) => {
                &["SPV_EXT_descriptor_indexing"]
            }
            _ => &[],
        }
    } else {
        &[]
    }
}
// rspirv pulls its spec information from the latest version. However, we might not be compiling for
// the latest version.
// For example, we might run into this situation:
// OpCapability VulkanMemoryModel in SPIR-V v1.5 requires no extensions
// OpCapability VulkanMemoryModel in SPIR-V <= v1.4 requires OpExtension SPV_KHR_vulkan_memory_model
// rspirv uses SPIR-V v1.5 (as of now), and so it states that VulkanMemoryModel needs no extensions
// We're compiling for, say, SPIR-V 1.3, and ask rspirv if VulkanMemoryModel requires an extension
// It says no. We strip it. Things explode.
// So, this function is to encode any special version-specific rules that aren't in rspirv.
rspirv pulls its spec information from the latest version. However, we might not be compiling for
the latest version.
For example, we might run into this situation:
OpCapability VulkanMemoryModel in SPIR-V v1.5 requires no extensions
OpCapability VulkanMemoryModel in SPIR-V <= v1.4 requires OpExtension SPV_KHR_vulkan_memory_model
rspirv uses SPIR-V v1.5 (as of now), and so it states that VulkanMemoryModel needs no extensions
We're compiling for, say, SPIR-V 1.3, and ask rspirv if VulkanMemoryModel requires an extension
It says no. We strip it. Things explode.
So, this function is to encode any special version-specific rules that aren't in rspirv.
rspirv pulls its spec information from the latest version . However we might not be compiling for the latest version . For example we might run into this situation : OpCapability VulkanMemoryModel in SPIR - V v1 . 5 requires no extensions OpCapability VulkanMemoryModel in SPIR - V < = v1 . 4 requires OpExtension SPV_KHR_vulkan_memory_model rspirv uses SPIR - V v1 . 5 ( as of now ) and so it states that VulkanMemoryModel needs no extensions We ' re compiling for say SPIR - V 1 . 3 and ask rspirv if VulkanMemoryModel requires an extension It says no . We strip it . Things explode . So this function is to encode any special version - specific rules that aren ' t in rspirv .
fn additional_extensions(module: &Module, inst: &Instruction) -> &'static [&'static str] {
    if inst.class.opcode == Op::Capability {
        let version = module.header.as_ref().unwrap().version();
        match inst.operands[0].unwrap_capability() {
            Capability::VulkanMemoryModel if version < (1, 5) => &["SPV_KHR_vulkan_memory_model"],
            Capability::RuntimeDescriptorArray if version < (1, 5) => {
                &["SPV_EXT_descriptor_indexing"]
            }
            _ => &[],
        }
    } else {
        &[]
    }
}
fn additional_extensions ( module : & Module , inst : & Instruction ) -> & ' static [ & ' static str ] { if inst . class . opcode == Op :: Capability { let version = module . header . as_ref ( ) . unwrap ( ) . version ( ) ; match inst . operands [ 0 ] . unwrap_capability ( ) { Capability :: VulkanMemoryModel if version < ( 1 , 5 ) => & [ " " ] , Capability :: RuntimeDescriptorArray if version < ( 1 , 5 ) => { & [ " " ] } _ => & [ ] , } } else { & [ ] } }
rspirv pulls its spec information from the latest version.
rspirv pulls its spec information from the latest version .
module
&Module
inst
&Instruction
module
&Module
inst
&Instruction