Handle window minimization

Implemented as mentioned in the "Swap chain recreation" page in the
tutorial.
This commit is contained in:
Stephen Seo 2024-03-14 13:19:28 +09:00
parent f52c9029bc
commit fa26784e01

View file

@ -1529,6 +1529,19 @@ impl VulkanApp {
}
fn recreate_swap_chain(&mut self) -> Result<(), String> {
let mut width: i32 = 0;
let mut height: i32 = 0;
while width == 0 || height == 0 {
unsafe {
ffi::glfwGetFramebufferSize(
self.window,
std::ptr::addr_of_mut!(width),
std::ptr::addr_of_mut!(height),
);
ffi::glfwWaitEvents();
}
}
unsafe {
ffi::vkDeviceWaitIdle(self.device);
}