pub unsafe fn from_words_with_data<'a>(
        device: Arc<Device>,
        words: &[u32],
        spirv_version: Version,
        spirv_capabilities: impl IntoIterator<Item = &'a Capability>,
        spirv_extensions: impl IntoIterator<Item = &'a str>,
        entry_points: impl IntoIterator<Item = (String, EntryPointInfo)>,
    ) -> Result<Arc<ShaderModule>, ShaderCreationError> {
        if let Err(reason) = check_spirv_version(&device, spirv_version) {
            return Err(ShaderCreationError::SpirvVersionNotSupported {
                version: spirv_version,
                reason,
            });
        }

        for capability in spirv_capabilities {
            if let Err(reason) = check_spirv_capability(&device, capability.clone()) {
                return Err(ShaderCreationError::SpirvCapabilityNotSupported {
                    capability: capability.clone(),
                    reason,
                });
            }
        }

        for extension in spirv_extensions {
            if let Err(reason) = check_spirv_extension(&device, extension) {
                return Err(ShaderCreationError::SpirvExtensionNotSupported {
                    extension: extension.to_owned(),
                    reason,
                });
            }
        }

        let handle = {
            let infos = ash::vk::ShaderModuleCreateInfo {
                flags: ash::vk::ShaderModuleCreateFlags::empty(),
                code_size: words.len() * mem::size_of::<u32>(),
                p_code: words.as_ptr(),
                ..Default::default()
            };

            let fns = device.fns();
            let mut output = MaybeUninit::uninit();
            check_errors(fns.v1_0.create_shader_module(
                device.internal_object(),
                &infos,
                ptr::null(),
                output.as_mut_ptr(),
            ))?;
            output.assume_init()
        };

        Ok(Arc::new(ShaderModule {
            handle,
            device,
            entry_points: entry_points.into_iter().collect(),
        }))
    }
/// As `from_words`, but does not parse the code. Instead, you must provide the needed
/// information yourself. This can be useful if you've already done parsing yourself and
/// want to prevent Vulkano from doing it a second time.
///
/// # Safety
///
/// - The SPIR-V code is not validated at all.
/// - The provided information must match what the SPIR-V code contains.
As `from_words`, but does not parse the code. Instead, you must provide the needed
information yourself. This can be useful if you've already done parsing yourself and
want to prevent Vulkano from doing it a second time.
As ` from_words ` but does not parse the code . Instead you must provide the needed information yourself . This can be useful if you ' ve already done parsing yourself and want to prevent Vulkano from doing it a second time .
pub unsafe fn from_words_with_data<'a>(
        device: Arc<Device>,
        words: &[u32],
        spirv_version: Version,
        spirv_capabilities: impl IntoIterator<Item = &'a Capability>,
        spirv_extensions: impl IntoIterator<Item = &'a str>,
        entry_points: impl IntoIterator<Item = (String, EntryPointInfo)>,
    ) -> Result<Arc<ShaderModule>, ShaderCreationError> {
        if let Err(reason) = check_spirv_version(&device, spirv_version) {
            return Err(ShaderCreationError::SpirvVersionNotSupported {
                version: spirv_version,
                reason,
            });
        }
        for capability in spirv_capabilities {
            if let Err(reason) = check_spirv_capability(&device, capability.clone()) {
                return Err(ShaderCreationError::SpirvCapabilityNotSupported {
                    capability: capability.clone(),
                    reason,
                });
            }
        }
        for extension in spirv_extensions {
            if let Err(reason) = check_spirv_extension(&device, extension) {
                return Err(ShaderCreationError::SpirvExtensionNotSupported {
                    extension: extension.to_owned(),
                    reason,
                });
            }
        }
        let handle = {
            let infos = ash::vk::ShaderModuleCreateInfo {
                flags: ash::vk::ShaderModuleCreateFlags::empty(),
                code_size: words.len() * mem::size_of::<u32>(),
                p_code: words.as_ptr(),
                ..Default::default()
            };
            let fns = device.fns();
            let mut output = MaybeUninit::uninit();
            check_errors(fns.v1_0.create_shader_module(
                device.internal_object(),
                &infos,
                ptr::null(),
                output.as_mut_ptr(),
            ))?;
            output.assume_init()
        };
        Ok(Arc::new(ShaderModule {
            handle,
            device,
            entry_points: entry_points.into_iter().collect(),
        }))
    }
pub unsafe fn from_words_with_data < ' a > ( device : Arc < Device > , words : & [ u32 ] , spirv_version : Version , spirv_capabilities : impl IntoIterator < Item = & ' a Capability > , spirv_extensions : impl IntoIterator < Item = & ' a str > , entry_points : impl IntoIterator < Item = ( String , EntryPointInfo ) > , ) -> Result < Arc < ShaderModule > , ShaderCreationError > { if let Err ( reason ) = check_spirv_version ( & device , spirv_version ) { return Err ( ShaderCreationError :: SpirvVersionNotSupported { version : spirv_version , reason , } ) ; } for capability in spirv_capabilities { if let Err ( reason ) = check_spirv_capability ( & device , capability . clone ( ) ) { return Err ( ShaderCreationError :: SpirvCapabilityNotSupported { capability : capability . clone ( ) , reason , } ) ; } } for extension in spirv_extensions { if let Err ( reason ) = check_spirv_extension ( & device , extension ) { return Err ( ShaderCreationError :: SpirvExtensionNotSupported { extension : extension . to_owned ( ) , reason , } ) ; } } let handle = { let infos = ash :: vk :: ShaderModuleCreateInfo { flags : ash :: vk :: ShaderModuleCreateFlags :: empty ( ) , code_size : words . len ( ) * mem :: size_of :: < u32 > ( ) , p_code : words . as_ptr ( ) , .. Default :: default ( ) } ; let fns = device . fns ( ) ; let mut output = MaybeUninit :: uninit ( ) ; check_errors ( fns . v1_0 . create_shader_module ( device . internal_object ( ) , & infos , ptr :: null ( ) , output . as_mut_ptr ( ) , ) ) ? ; output . assume_init ( ) } ; Ok ( Arc :: new ( ShaderModule { handle , device , entry_points : entry_points . into_iter ( ) . collect ( ) , } ) ) }
As `from_words`, but does not parse the code.
As ` from_words ` but does not parse the code .
device
Arc<Device>
words
&[u32]
spirv_version
Version
spirv_capabilities
impl IntoIterator<Item = &'a Capability>
spirv_extensions
impl IntoIterator<Item = &'a str>
entry_points
impl IntoIterator<Item = (String, EntryPointInfo)>
device
Arc<Device>
words
&[u32]
spirv_version
Version
spirv_capabilities
impl IntoIterator<Item = &'a Capability>
spirv_extensions
impl IntoIterator<Item = &'a str>
entry_points
impl IntoIterator<Item = (String, EntryPointInfo)>
safety
The SPIR-V code is not validated at all.
The provided information must match what the SPIR-V code contains.
The SPIR - V code is not validated at all . The provided information must match what the SPIR - V code contains .