Handle window minimization
Implemented as mentioned in the "Swap chain recreation" page in the tutorial.
This commit is contained in:
parent
f52c9029bc
commit
fa26784e01
1 changed files with 13 additions and 0 deletions
13
src/main.rs
13
src/main.rs
|
@ -1529,6 +1529,19 @@ impl VulkanApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn recreate_swap_chain(&mut self) -> Result<(), String> {
|
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 {
|
unsafe {
|
||||||
ffi::vkDeviceWaitIdle(self.device);
|
ffi::vkDeviceWaitIdle(self.device);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue