diff options
Diffstat (limited to 'src/graphics_permanent.rs')
| -rw-r--r-- | src/graphics_permanent.rs | 17 |
1 files changed, 14 insertions, 3 deletions
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<Window> { // Notice that we do this before having a Vulkan instance. The window is // actually a parameter needed to create the instance; see |