From ecaac2afc11aaf36f2ab5f17a3711b4cd34656b6 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Thu, 19 Oct 2023 14:24:01 +1100 Subject: [PATCH] reinitialise image slice on resize --- lib/src/renderer/vulkan/vulkan.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/src/renderer/vulkan/vulkan.rs b/lib/src/renderer/vulkan/vulkan.rs index 566092e..cd88de7 100644 --- a/lib/src/renderer/vulkan/vulkan.rs +++ b/lib/src/renderer/vulkan/vulkan.rs @@ -479,6 +479,22 @@ impl VulkanWindowInner { SwapchainData::new(resolutions, manager, &self.surface, &self.vulkan_data); self.framebuffers = FramebufferData::new(&self.swapchain, &self.vulkan_data, self.renderpass); + + let image_ptr = self + .vulkan_data + .device + .map_memory( + self.swapchain.shader_input_image_buffer_memory, + 0, + self.swapchain.shader_input_image_buffer_memory_req.size, + vk::MemoryMapFlags::empty(), + ) + .unwrap(); + self.image_slice = Align::new( + image_ptr, + std::mem::align_of::() as u64, + self.swapchain.shader_input_image_buffer_memory_req.size, + ); } unsafe fn new_frame(&mut self, buffer: &[[u8; 4]]) {