GPUOpen-Archive / Anvil

Anvil is a cross-platform framework for Vulkan
MIT License
594 stars 62 forks source link

Unhandled VK_ERROR_OUT_OF_DATE_KHR when Anvil-based program with window is minimized with Nvidia drivers #132

Closed Silverlan closed 5 years ago

Silverlan commented 5 years ago

This happens for example when running the MultiViewport demo with a Nvidia GPU, and then minimizing the window. (Tested with a Nvidia GTX 650 Ti BOOST) The reason is that vkQueuePresentKHR in _Queue::presentinternal returns _VK_ERROR_OUT_OF_DATEKHR, which isn't being handled by Anvil.

I'm not sure whether to consider this a bug, I guess it's more of a feature request? I think it would make sense for Anvil to handle this case.

DominikWitczakAMD commented 5 years ago

The out-of-date error was actually one of the reasons Anvil::Queue::present_internal() has had added. :-)

We could theoretically have Anvil re-create the swapchain behind the curtains. However, this is something I'd rather have apps handle this event explicitly. I'm also worried about implications of the app ignoring the fact the swapchain is no longer functional.

Anvil has been proven to correctly handle use cases where app recreates the swapchain. One of the projects I'm aware of that does this is VKGL (https://github.com/kbiElude/VKGL ).

DominikWitczakAMD commented 5 years ago

One more reason I'm against handling this event at library level is my past experience with deferred baking. When Anvil started, a lot of things would be sneakily handled by the library. This resulted in all sorts of side effects it took me quite some time to get right, in most cases by getting rid of the said mechanism. I'd rather not take that path again.

DominikWitczakAMD commented 5 years ago

Assuming we reached an agreement :) Please feel free to reopen the issue if we need to rediscuss this.