pub fn create_logical_device(
        &self,
        physical_device: &vk::PhysicalDevice,
        physical_device_features: vk::PhysicalDeviceFeatures,
        physical_device_extensions: &[String],
        queue_create_infos: &[vk::DeviceQueueCreateInfo],
    ) -> Result<ash::Device> {
        use anyhow::Context;

        let (_c_names, layer_name_ptrs) = unsafe { to_os_ptrs(&self.layers) };
        let (_c_ext_names, ext_name_ptrs) =
            unsafe { to_os_ptrs(physical_device_extensions) };

        let create_info = vk::DeviceCreateInfo {
            queue_create_info_count: queue_create_infos.len() as u32,
            p_queue_create_infos: queue_create_infos.as_ptr(),
            p_enabled_features: &physical_device_features,
            pp_enabled_layer_names: layer_name_ptrs.as_ptr(),
            enabled_layer_count: layer_name_ptrs.len() as u32,
            pp_enabled_extension_names: ext_name_ptrs.as_ptr(),
            enabled_extension_count: physical_device_extensions.len() as u32,
            ..Default::default()
        };

        let logical_device = unsafe {
            self.ash
                .create_device(*physical_device, &create_info, None)
                .context("unable to create the logical device")?
        };

        Ok(logical_device)
    }
/// Create a new logical device for use by this application. The caller is
/// responsible for destroying the device when done.
Create a new logical device for use by this application. The caller is
responsible for destroying the device when done.
Create a new logical device for use by this application . The caller is responsible for destroying the device when done .
pub fn create_logical_device(
        &self,
        physical_device: &vk::PhysicalDevice,
        physical_device_features: vk::PhysicalDeviceFeatures,
        physical_device_extensions: &[String],
        queue_create_infos: &[vk::DeviceQueueCreateInfo],
    ) -> Result<ash::Device> {
        use anyhow::Context;
        let (_c_names, layer_name_ptrs) = unsafe { to_os_ptrs(&self.layers) };
        let (_c_ext_names, ext_name_ptrs) =
            unsafe { to_os_ptrs(physical_device_extensions) };
        let create_info = vk::DeviceCreateInfo {
            queue_create_info_count: queue_create_infos.len() as u32,
            p_queue_create_infos: queue_create_infos.as_ptr(),
            p_enabled_features: &physical_device_features,
            pp_enabled_layer_names: layer_name_ptrs.as_ptr(),
            enabled_layer_count: layer_name_ptrs.len() as u32,
            pp_enabled_extension_names: ext_name_ptrs.as_ptr(),
            enabled_extension_count: physical_device_extensions.len() as u32,
            ..Default::default()
        };
        let logical_device = unsafe {
            self.ash
                .create_device(*physical_device, &create_info, None)
                .context("unable to create the logical device")?
        };
        Ok(logical_device)
    }
pub fn create_logical_device ( & self , physical_device : & vk :: PhysicalDevice , physical_device_features : vk :: PhysicalDeviceFeatures , physical_device_extensions : & [ String ] , queue_create_infos : & [ vk :: DeviceQueueCreateInfo ] , ) -> Result < ash :: Device > { use anyhow :: Context ; let ( _c_names , layer_name_ptrs ) = unsafe { to_os_ptrs ( & self . layers ) } ; let ( _c_ext_names , ext_name_ptrs ) = unsafe { to_os_ptrs ( physical_device_extensions ) } ; let create_info = vk :: DeviceCreateInfo { queue_create_info_count : queue_create_infos . len ( ) as u32 , p_queue_create_infos : queue_create_infos . as_ptr ( ) , p_enabled_features : & physical_device_features , pp_enabled_layer_names : layer_name_ptrs . as_ptr ( ) , enabled_layer_count : layer_name_ptrs . len ( ) as u32 , pp_enabled_extension_names : ext_name_ptrs . as_ptr ( ) , enabled_extension_count : physical_device_extensions . len ( ) as u32 , .. Default :: default ( ) } ; let logical_device = unsafe { self . ash . create_device ( * physical_device , & create_info , None ) . context ( " " ) ? } ; Ok ( logical_device ) }
Create a new logical device for use by this application.
Create a new logical device for use by this application .
&self
physical_device
&vk::PhysicalDevice
physical_device_features
vk::PhysicalDeviceFeatures
physical_device_extensions
&[String]
queue_create_infos
&[vk::DeviceQueueCreateInfo]