From 69e3a6578e916a203acfb59d9cc5c93774de2e4a Mon Sep 17 00:00:00 2001 From: Emil Date: Mon, 22 Jun 2026 19:37:59 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20zoom=20crash=20=E2=80=94=20check=5Fresiz?= =?UTF-8?q?e=20after=20zoom=20to=20reallocate=20instance=20buffer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit adjust_zoom now calls check_resize() which recalculates grid_w/grid_h and reallocates the GPU instance buffer to match the new grid size. Previously zoom changed grid_w/h but the buffer stayed at the old size, causing index-out-of-bounds panic. --- src/render/graphics.rs | 7 +------ src/render/vulkan.rs | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/render/graphics.rs b/src/render/graphics.rs index 277eefa..60276ab 100644 --- a/src/render/graphics.rs +++ b/src/render/graphics.rs @@ -1122,12 +1122,7 @@ impl GraphicsRenderer { return; } self.char_size = new_size; - let new_grid_w = (self.swapchain_extent.width / self.char_size) as usize; - let new_grid_h = (self.swapchain_extent.height / self.char_size) as usize; - if new_grid_w > 0 && new_grid_h > 0 { - self.grid_w = new_grid_w; - self.grid_h = new_grid_h; - } + self.check_resize(); } pub fn cell_pixel_size(&self) -> u32 { diff --git a/src/render/vulkan.rs b/src/render/vulkan.rs index 9d8ceb6..5e71e57 100644 --- a/src/render/vulkan.rs +++ b/src/render/vulkan.rs @@ -719,12 +719,7 @@ impl VulkanRenderer { return; } self.char_size = new_size; - let new_grid_w = (self.swapchain_extent.width / self.char_size) as usize; - let new_grid_h = (self.swapchain_extent.height / self.char_size) as usize; - if new_grid_w > 0 && new_grid_h > 0 { - self.grid_w = new_grid_w; - self.grid_h = new_grid_h; - } + self.check_resize(); } pub fn cell_pixel_size(&self) -> u32 {