From e547dc5ab4ec1667bcde6368f756f63123eae587 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Thu, 9 Jul 2026 17:41:09 -0700 Subject: okay, reinitializing for window changes works now yay Force-Push: yes Change-Id: Id8dce4cd4bc696be322fe5b612837e3651437f7e --- src/graphics_permanent.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/graphics_permanent.rs') diff --git a/src/graphics_permanent.rs b/src/graphics_permanent.rs index d41bbfa..c2225a3 100644 --- a/src/graphics_permanent.rs +++ b/src/graphics_permanent.rs @@ -94,8 +94,7 @@ pub struct EnableSwapchain(pub bool); impl PermanentGraphicsState { #[allow(unsafe_code)] pub fn new(event_loop: &ActiveEventLoop) - -> Result<(Self, vk::PhysicalDevice, QueueFamilyIndices, - EnableSwapchain)> + -> Result<(Self, GraphicsStateForReinit, EnableSwapchain)> { let window = init_window(event_loop)?; @@ -131,7 +130,9 @@ impl PermanentGraphicsState { Ok((PermanentGraphicsState { window, entry, instance, debug_messager, surface, device, graphics_queue, presentation_queue, - }, physical_device, indices, enable_swapchain)) + }, GraphicsStateForReinit { + physical_device, indices + }, enable_swapchain)) } #[allow(unsafe_code)] @@ -206,6 +207,16 @@ impl PermanentGraphicsState { } +// The GraphicsStateForReinit connects Vulkan objects which are only needed +// during the creation of the window-dressing objects. They are used during +// initial startup, and again any time the window-dressing needs to be +// reinitialized. Most notably, they are not needed when rendering. +pub struct GraphicsStateForReinit { + pub physical_device: vk::PhysicalDevice, + pub indices: QueueFamilyIndices, +} + + fn init_window(event_loop: &ActiveEventLoop) -> Result { // Notice that we do this before having a Vulkan instance. The window is // actually a parameter needed to create the instance; see -- cgit 1.4.1