fn new_with_debug_user_data<W: HasRawWindowHandle, OW: Into<Option<Arc<W>>>>(
    window: OW, config: Config, debug_user_data: Option<Pin<Arc<DebugUserData>>>,
  ) -> SarektResult<Self> {
    let window = window
      .into()
      .expect("Sarekt only supports rendering to a window right now :(");

    // TODO(issue#9) OFFSCREEN Support rendering to a non window surface if window
    // is None (change it to an Enum of WindowHandle or OtherSurface).
    info!("Creating Sarekt Renderer with Vulkan Backend...");

    let vulkan_core = ManuallyDrop::new(VulkanCoreStructures::new(
      window.as_ref(),
      config.application_details,
      config.engine_details,
      debug_user_data,
    )?);

    let vulkan_device_structures =
      ManuallyDrop::new(VulkanDeviceStructures::new(&vulkan_core, &config)?);
    let physical_device = vulkan_device_structures.physical_device;
    let logical_device = &vulkan_device_structures.logical_device;
    let queue_families = &vulkan_device_structures.queue_families;
    let queues = &vulkan_device_structures.queues;

    // TODO(issue#9) OFFSCREEN only create if drawing to window, get format and
    // extent elsewhere.
    let render_target_bundle = RenderTargetBundle::new(
      &vulkan_core,
      &vulkan_device_structures,
      config.requested_width,
      config.requested_height,
      config.present_mode,
    )?;
    let render_targets = &render_target_bundle.render_targets;

    let (main_gfx_command_pool, transfer_command_pool) =
      Self::create_primary_command_pools(queue_families, &logical_device)?;

    let allocator = Self::create_memory_allocator(
      vulkan_core.instance.as_ref().clone(),
      physical_device,
      logical_device.as_ref().clone(),
    )?;

    let shader_store = Self::create_shader_store(&logical_device);

    // TODO(issue#1) MULTITHREADING all graphics command pools needed here to
    // specify concurrent access.
    let buffer_image_store = ManuallyDrop::new(Self::create_buffer_image_store(
      &vulkan_core,
      &vulkan_device_structures,
      allocator.clone(),
      queue_families.graphics_queue_family.unwrap(),
      queue_families.transfer_queue_family.unwrap(),
      transfer_command_pool,
      queues.transfer_queue,
      main_gfx_command_pool,
      queues.graphics_queue,
    )?);

    let pipeline = Pipelines::new(
      &config,
      &vulkan_core,
      &vulkan_device_structures,
      &render_target_bundle,
      &shader_store,
      &buffer_image_store,
    )?;
    let framebuffers = &pipeline.framebuffers;

    let primary_gfx_command_buffers =
      Self::create_main_gfx_command_buffers(&logical_device, main_gfx_command_pool, framebuffers)?;

    let draw_synchronization =
      DrawSynchronization::new(logical_device.clone(), render_targets.len())?;

    let main_descriptor_pools = Self::create_main_descriptor_pools(
      &vulkan_core.instance,
      physical_device,
      &logical_device,
      &render_targets,
    )?;

    let mut renderer = Self {
      vulkan_core,
      vulkan_device_structures,
      render_target_bundle,
      pipelines: pipeline,

      main_gfx_command_pool,
      primary_gfx_command_buffers,
      transfer_command_pool,
      draw_synchronization,
      frame_count: Cell::new(0),
      current_frame_num: Cell::new(0),
      next_image_index: Cell::new(0),

      main_descriptor_pools,

      allocator,
      shader_store,
      buffer_image_store,

      // To be initialized.
      default_texture: None,

      rendering_enabled: true,

      config,
    };

    renderer.create_default_texture();

    // Begin recording first command buffer so the first call to Drawer::draw is
    // ready to record.  The rest are started by Renderer::frame.
    renderer.setup_next_main_command_buffer()?;

    Ok(renderer)
  }
/// Like new_detailed but allows injection of user data, for unit testing or
/// metric gathering.
Like new_detailed but allows injection of user data, for unit testing or
metric gathering.
Like new_detailed but allows injection of user data for unit testing or metric gathering .
fn new_with_debug_user_data<W: HasRawWindowHandle, OW: Into<Option<Arc<W>>>>(
    window: OW, config: Config, debug_user_data: Option<Pin<Arc<DebugUserData>>>,
  ) -> SarektResult<Self> {
    let window = window
      .into()
      .expect("Sarekt only supports rendering to a window right now :(");
    // TODO(issue#9) OFFSCREEN Support rendering to a non window surface if window
    // is None (change it to an Enum of WindowHandle or OtherSurface).
    info!("Creating Sarekt Renderer with Vulkan Backend...");
    let vulkan_core = ManuallyDrop::new(VulkanCoreStructures::new(
      window.as_ref(),
      config.application_details,
      config.engine_details,
      debug_user_data,
    )?);
    let vulkan_device_structures =
      ManuallyDrop::new(VulkanDeviceStructures::new(&vulkan_core, &config)?);
    let physical_device = vulkan_device_structures.physical_device;
    let logical_device = &vulkan_device_structures.logical_device;
    let queue_families = &vulkan_device_structures.queue_families;
    let queues = &vulkan_device_structures.queues;
    // TODO(issue#9) OFFSCREEN only create if drawing to window, get format and
    // extent elsewhere.
    let render_target_bundle = RenderTargetBundle::new(
      &vulkan_core,
      &vulkan_device_structures,
      config.requested_width,
      config.requested_height,
      config.present_mode,
    )?;
    let render_targets = &render_target_bundle.render_targets;
    let (main_gfx_command_pool, transfer_command_pool) =
      Self::create_primary_command_pools(queue_families, &logical_device)?;
    let allocator = Self::create_memory_allocator(
      vulkan_core.instance.as_ref().clone(),
      physical_device,
      logical_device.as_ref().clone(),
    )?;
    let shader_store = Self::create_shader_store(&logical_device);
    // TODO(issue#1) MULTITHREADING all graphics command pools needed here to
    // specify concurrent access.
    let buffer_image_store = ManuallyDrop::new(Self::create_buffer_image_store(
      &vulkan_core,
      &vulkan_device_structures,
      allocator.clone(),
      queue_families.graphics_queue_family.unwrap(),
      queue_families.transfer_queue_family.unwrap(),
      transfer_command_pool,
      queues.transfer_queue,
      main_gfx_command_pool,
      queues.graphics_queue,
    )?);
    let pipeline = Pipelines::new(
      &config,
      &vulkan_core,
      &vulkan_device_structures,
      &render_target_bundle,
      &shader_store,
      &buffer_image_store,
    )?;
    let framebuffers = &pipeline.framebuffers;
    let primary_gfx_command_buffers =
      Self::create_main_gfx_command_buffers(&logical_device, main_gfx_command_pool, framebuffers)?;
    let draw_synchronization =
      DrawSynchronization::new(logical_device.clone(), render_targets.len())?;
    let main_descriptor_pools = Self::create_main_descriptor_pools(
      &vulkan_core.instance,
      physical_device,
      &logical_device,
      &render_targets,
    )?;
    let mut renderer = Self {
      vulkan_core,
      vulkan_device_structures,
      render_target_bundle,
      pipelines: pipeline,
      main_gfx_command_pool,
      primary_gfx_command_buffers,
      transfer_command_pool,
      draw_synchronization,
      frame_count: Cell::new(0),
      current_frame_num: Cell::new(0),
      next_image_index: Cell::new(0),
      main_descriptor_pools,
      allocator,
      shader_store,
      buffer_image_store,
      // To be initialized.
      default_texture: None,
      rendering_enabled: true,
      config,
    };
    renderer.create_default_texture();
    // Begin recording first command buffer so the first call to Drawer::draw is
    // ready to record.  The rest are started by Renderer::frame.
    renderer.setup_next_main_command_buffer()?;
    Ok(renderer)
  }
fn new_with_debug_user_data < W : HasRawWindowHandle , OW : Into < Option < Arc < W > > > > ( window : OW , config : Config , debug_user_data : Option < Pin < Arc < DebugUserData > > > , ) -> SarektResult < Self > { let window = window . into ( ) . expect ( " " ) ; // TODO(issue#9) OFFSCREEN Support rendering to a non window surface if window // is None (change it to an Enum of WindowHandle or OtherSurface). info ! ( " " ) ; let vulkan_core = ManuallyDrop :: new ( VulkanCoreStructures :: new ( window . as_ref ( ) , config . application_details , config . engine_details , debug_user_data , ) ? ) ; let vulkan_device_structures = ManuallyDrop :: new ( VulkanDeviceStructures :: new ( & vulkan_core , & config ) ? ) ; let physical_device = vulkan_device_structures . physical_device ; let logical_device = & vulkan_device_structures . logical_device ; let queue_families = & vulkan_device_structures . queue_families ; let queues = & vulkan_device_structures . queues ; // TODO(issue#9) OFFSCREEN only create if drawing to window, get format and // extent elsewhere. let render_target_bundle = RenderTargetBundle :: new ( & vulkan_core , & vulkan_device_structures , config . requested_width , config . requested_height , config . present_mode , ) ? ; let render_targets = & render_target_bundle . render_targets ; let ( main_gfx_command_pool , transfer_command_pool ) = Self :: create_primary_command_pools ( queue_families , & logical_device ) ? ; let allocator = Self :: create_memory_allocator ( vulkan_core . instance . as_ref ( ) . clone ( ) , physical_device , logical_device . as_ref ( ) . clone ( ) , ) ? ; let shader_store = Self :: create_shader_store ( & logical_device ) ; // TODO(issue#1) MULTITHREADING all graphics command pools needed here to // specify concurrent access. let buffer_image_store = ManuallyDrop :: new ( Self :: create_buffer_image_store ( & vulkan_core , & vulkan_device_structures , allocator . clone ( ) , queue_families . graphics_queue_family . unwrap ( ) , queue_families . transfer_queue_family . unwrap ( ) , transfer_command_pool , queues . transfer_queue , main_gfx_command_pool , queues . graphics_queue , ) ? ) ; let pipeline = Pipelines :: new ( & config , & vulkan_core , & vulkan_device_structures , & render_target_bundle , & shader_store , & buffer_image_store , ) ? ; let framebuffers = & pipeline . framebuffers ; let primary_gfx_command_buffers = Self :: create_main_gfx_command_buffers ( & logical_device , main_gfx_command_pool , framebuffers ) ? ; let draw_synchronization = DrawSynchronization :: new ( logical_device . clone ( ) , render_targets . len ( ) ) ? ; let main_descriptor_pools = Self :: create_main_descriptor_pools ( & vulkan_core . instance , physical_device , & logical_device , & render_targets , ) ? ; let mut renderer = Self { vulkan_core , vulkan_device_structures , render_target_bundle , pipelines : pipeline , main_gfx_command_pool , primary_gfx_command_buffers , transfer_command_pool , draw_synchronization , frame_count : Cell :: new ( 0 ) , current_frame_num : Cell :: new ( 0 ) , next_image_index : Cell :: new ( 0 ) , main_descriptor_pools , allocator , shader_store , buffer_image_store , // To be initialized. default_texture : None , rendering_enabled : true , config , } ; renderer . create_default_texture ( ) ; // Begin recording first command buffer so the first call to Drawer::draw is // ready to record.  The rest are started by Renderer::frame. renderer . setup_next_main_command_buffer ( ) ? ; Ok ( renderer ) }
Like new_detailed but allows injection of user data, for unit testing or
metric gathering.
Like new_detailed but allows injection of user data for unit testing or metric gathering .
window
OW
config
Config
debug_user_data
Option<Pin<Arc<DebugUserData>>>
window
OW
config
Config
debug_user_data
Option<Pin<Arc<DebugUserData>>>