MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / recreate_swapchain

Method recreate_swapchain

examples/runners/ash/src/main.rs:887–918  ·  view source on GitHub ↗

Recreates the swapchain, but does not recreate the pipelines because they use dynamic state.

(&mut self)

Source from the content-addressed store, hash-verified

885
886 /// Recreates the swapchain, but does not recreate the pipelines because they use dynamic state.
887 pub fn recreate_swapchain(&mut self) {
888 let surface_resolution = self.base.surface_resolution();
889
890 if surface_resolution.width == 0 || surface_resolution.height == 0 {
891 self.rendering_paused = true;
892 return;
893 } else if self.rendering_paused {
894 self.rendering_paused = false;
895 };
896
897 self.cleanup_swapchain();
898
899 let (swapchain, extent) = self.base.create_swapchain();
900 self.swapchain = swapchain;
901 self.extent = extent;
902 self.image_views = self.base.create_image_views(self.swapchain);
903 self.framebuffers =
904 self.base
905 .create_framebuffers(&self.image_views, self.render_pass, extent);
906 self.viewports = Box::new([vk::Viewport {
907 x: 0.0,
908 y: extent.height as f32,
909 width: extent.width as f32,
910 height: -(extent.height as f32),
911 min_depth: 0.0,
912 max_depth: 1.0,
913 }]);
914 self.scissors = Box::new([vk::Rect2D {
915 offset: vk::Offset2D { x: 0, y: 0 },
916 extent,
917 }]);
918 }
919
920 pub fn render(&mut self) {
921 let present_index = unsafe {

Callers 2

mainFunction · 0.80
renderMethod · 0.80

Calls 5

surface_resolutionMethod · 0.80
cleanup_swapchainMethod · 0.80
create_swapchainMethod · 0.80
create_image_viewsMethod · 0.80
create_framebuffersMethod · 0.80

Tested by

no test coverage detected