/// Recreates teh swapchain using the new parameters and returns the old
/// swapchain and images/views.
///
/// Unsafe because of FFI use and the returned swapchain must be cleaned up.
Recreates teh swapchain using the new parameters and returns the old
swapchain and images/views.

Unsafe because of FFI use and the returned swapchain must be cleaned up.
Recreates teh swapchain using the new parameters and returns the old swapchain and images / views . Unsafe because of FFI use and the returned swapchain must be cleaned up .
pub unsafe fn recreate_swapchain(
    &mut self, vulkan_core: &VulkanCoreStructures, device_bundle: &VulkanDeviceStructures,
    requested_width: u32, requested_height: u32, requested_present_mode: PresentMode,
  ) -> SarektResult<(vk::SwapchainKHR, Vec<ImageAndView>)> {
    let old_swapchain = self.swapchain_and_extension.swapchain;
    let (new_swapchain, new_format, new_extent) = RenderTargetBundle::create_swapchain(
      &vulkan_core.surface_and_extension,
      &self.swapchain_and_extension.swapchain_functions,
      device_bundle.physical_device,
      &device_bundle.queue_families,
      requested_width,
      requested_height,
      requested_present_mode,
      Some(old_swapchain),
    )?;
    self.swapchain_and_extension.swapchain = new_swapchain;
    self.swapchain_and_extension.format = new_format;
    self.extent = new_extent;
    // TODO(issue#9) OFFSCREEN if not swapchain create images that im rendering to.
    let render_target_images = self
      .swapchain_and_extension
      .swapchain_functions
      .get_swapchain_images(new_swapchain)?;
    let mut render_targets = Self::create_render_target_image_views(
      &device_bundle.logical_device,
      render_target_images,
      new_format,
    )?;
    std::mem::swap(&mut self.render_targets, &mut render_targets);
    Ok((old_swapchain, render_targets))
  }
pub unsafe fn recreate_swapchain ( & mut self , vulkan_core : & VulkanCoreStructures , device_bundle : & VulkanDeviceStructures , requested_width : u32 , requested_height : u32 , requested_present_mode : PresentMode , ) -> SarektResult < ( vk :: SwapchainKHR , Vec < ImageAndView > ) > { let old_swapchain = self . swapchain_and_extension . swapchain ; let ( new_swapchain , new_format , new_extent ) = RenderTargetBundle :: create_swapchain ( & vulkan_core . surface_and_extension , & self . swapchain_and_extension . swapchain_functions , device_bundle . physical_device , & device_bundle . queue_families , requested_width , requested_height , requested_present_mode , Some ( old_swapchain ) , ) ? ; self . swapchain_and_extension . swapchain = new_swapchain ; self . swapchain_and_extension . format = new_format ; self . extent = new_extent ; // TODO(issue#9) OFFSCREEN if not swapchain create images that im rendering to. let render_target_images = self . swapchain_and_extension . swapchain_functions . get_swapchain_images ( new_swapchain ) ? ; let mut render_targets = Self :: create_render_target_image_views ( & device_bundle . logical_device , render_target_images , new_format , ) ? ; std :: mem :: swap ( & mut self . render_targets , & mut render_targets ) ; Ok ( ( old_swapchain , render_targets ) ) }
Recreates teh swapchain using the new parameters and returns the old
swapchain and images/views.
Recreates teh swapchain using the new parameters and returns the old swapchain and images / views .
&mut self
vulkan_core
&VulkanCoreStructures
device_bundle
&VulkanDeviceStructures
requested_width
u32
requested_height
u32
requested_present_mode
PresentMode