fix: zoom crash — check_resize after zoom to reallocate instance buffer
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.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user