Closed BastianBlokland closed 6 years ago
Nice find; I was unable to reproduce the issue on my machine. Really appreciate the contributions, @BastianBlokland!
Aha, there is a regression here though.
Consider the case where you maximize the window such that _form.WindowState == FormWindowState.Maximized
. Alt tabbing to another window raises the deactivate event, pausing the app. Alt tabbing back to app raises the activate event which no longer unpauses it because window state is not FormWindowState.Normal
.
So I guess a proper solution would be to use _appPaused = _form.WindowState == FormWindowState.Minimized;
. Am I on the right track here?
Edit: I applied the fix here: https://github.com/discosultan/VulkanCore/commit/447fe3cdbdd21738ee5dbb36d3bce27beb27b80b
Good point, i hadn't considered that 😅 Pretty interesting that it seems to behave differently on different machines, i've tested on a windows 10 machine and build from Visual Studio 15.6.5
When returning from a minimised state on windows it would throw a: 'OutOfDateKHR' on the 'vkQueuePresentKHR' because of ordering of events in Win32Window.cs
Received event order on minimize and restore: 1 _form.Resize with _form.WindowState == Minimized 2 _form.Deactivated 3 _form.Activated
So the .Resize callback would properly set _appPaused but the .Activate would unset it again causing the 'Run' to render even though the surface was out of date.