fn create_instance(
        required_extensions: &Vec<String>,
    ) -> Result<(ash::Instance, Entry)> {
        let entry = Entry::new()?;

        let mut required_with_debug = required_extensions.clone();
        required_with_debug.push(DebugUtils::name().to_str()?.to_owned());

        extensions::check_extensions(&entry, &required_with_debug)?;
        layers::check_layers(&entry, &Self::debug_layers())?;

        log::debug!("Required Extensions {:?}", required_extensions);

        let app_name = CString::new("ash starter").unwrap();
        let engine_name = CString::new("no engine").unwrap();

        let app_info = vk::ApplicationInfo {
            p_engine_name: engine_name.as_ptr(),
            p_application_name: app_name.as_ptr(),
            application_version: vk::make_version(1, 0, 0),
            engine_version: vk::make_version(1, 0, 0),
            api_version: vk::make_version(1, 1, 0),
            ..Default::default()
        };

        let (_layer_names, layer_ptrs) =
            unsafe { to_os_ptrs(&Self::debug_layers()) };
        let (_ext_names, ext_ptrs) =
            unsafe { to_os_ptrs(&required_with_debug) };

        let create_info = vk::InstanceCreateInfo {
            p_application_info: &app_info,
            pp_enabled_layer_names: layer_ptrs.as_ptr(),
            enabled_layer_count: layer_ptrs.len() as u32,
            pp_enabled_extension_names: ext_ptrs.as_ptr(),
            enabled_extension_count: ext_ptrs.len() as u32,
            ..Default::default()
        };

        let instance = unsafe { entry.create_instance(&create_info, None)? };

        Ok((instance, entry))
    }
/// Create a Vulkan instance with the required extensions.
/// Returns an `Err()` if any required extensions are unavailable.
Create a Vulkan instance with the required extensions.
Returns an `Err()` if any required extensions are unavailable.
Create a Vulkan instance with the required extensions . Returns an ` Err () ` if any required extensions are unavailable .
fn create_instance(
        required_extensions: &Vec<String>,
    ) -> Result<(ash::Instance, Entry)> {
        let entry = Entry::new()?;
        let mut required_with_debug = required_extensions.clone();
        required_with_debug.push(DebugUtils::name().to_str()?.to_owned());
        extensions::check_extensions(&entry, &required_with_debug)?;
        layers::check_layers(&entry, &Self::debug_layers())?;
        log::debug!("Required Extensions {:?}", required_extensions);
        let app_name = CString::new("ash starter").unwrap();
        let engine_name = CString::new("no engine").unwrap();
        let app_info = vk::ApplicationInfo {
            p_engine_name: engine_name.as_ptr(),
            p_application_name: app_name.as_ptr(),
            application_version: vk::make_version(1, 0, 0),
            engine_version: vk::make_version(1, 0, 0),
            api_version: vk::make_version(1, 1, 0),
            ..Default::default()
        };
        let (_layer_names, layer_ptrs) =
            unsafe { to_os_ptrs(&Self::debug_layers()) };
        let (_ext_names, ext_ptrs) =
            unsafe { to_os_ptrs(&required_with_debug) };
        let create_info = vk::InstanceCreateInfo {
            p_application_info: &app_info,
            pp_enabled_layer_names: layer_ptrs.as_ptr(),
            enabled_layer_count: layer_ptrs.len() as u32,
            pp_enabled_extension_names: ext_ptrs.as_ptr(),
            enabled_extension_count: ext_ptrs.len() as u32,
            ..Default::default()
        };
        let instance = unsafe { entry.create_instance(&create_info, None)? };
        Ok((instance, entry))
    }
fn create_instance ( required_extensions : & Vec < String > , ) -> Result < ( ash :: Instance , Entry ) > { let entry = Entry :: new ( ) ? ; let mut required_with_debug = required_extensions . clone ( ) ; required_with_debug . push ( DebugUtils :: name ( ) . to_str ( ) ? . to_owned ( ) ) ; extensions :: check_extensions ( & entry , & required_with_debug ) ? ; layers :: check_layers ( & entry , & Self :: debug_layers ( ) ) ? ; log :: debug ! ( " " required_extensions ) ; let app_name = CString :: new ( " " ) . unwrap ( ) ; let engine_name = CString :: new ( " " ) . unwrap ( ) ; let app_info = vk :: ApplicationInfo { p_engine_name : engine_name . as_ptr ( ) , p_application_name : app_name . as_ptr ( ) , application_version : vk :: make_version ( 1 , 0 , 0 ) , engine_version : vk :: make_version ( 1 , 0 , 0 ) , api_version : vk :: make_version ( 1 , 1 , 0 ) , .. Default :: default ( ) } ; let ( _layer_names , layer_ptrs ) = unsafe { to_os_ptrs ( & Self :: debug_layers ( ) ) } ; let ( _ext_names , ext_ptrs ) = unsafe { to_os_ptrs ( & required_with_debug ) } ; let create_info = vk :: InstanceCreateInfo { p_application_info : & app_info , pp_enabled_layer_names : layer_ptrs . as_ptr ( ) , enabled_layer_count : layer_ptrs . len ( ) as u32 , pp_enabled_extension_names : ext_ptrs . as_ptr ( ) , enabled_extension_count : ext_ptrs . len ( ) as u32 , .. Default :: default ( ) } ; let instance = unsafe { entry . create_instance ( & create_info , None ) ? } ; Ok ( ( instance , entry ) ) }
Create a Vulkan instance with the required extensions.
Create a Vulkan instance with the required extensions .
required_extensions
&Vec<String>