We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4408

Summary: Vulkan Window Slow to Show
Product: SDL Reporter: Diego <diegoacevedo91>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: 2.0.9   
Hardware: x86_64   
OS: Mac OS X (All)   

Description Diego 2018-12-01 20:14:35 UTC
I'm testing on MacOS 10.14.1 using testvulkan.c. After the window is created, if it is moved completely behind another window and then brought back to the front again (such as by command-tabbing), sometimes it is very slow to show. 
After pressing command-tab or clicking on the applications icon in the dock it can take several seconds before the window is actually shown. This doesn't seem to be the case if the window is not completely hidden behind another window. I could not reproduce this with MoltenVK's demoes. They showed promptly.
Comment 1 Ryan C. Gordon 2019-06-24 00:43:42 UTC
I haven't looked into this further than throwing some SDL_GetTicks() calls in there, but the reason this happens is the vkWaitForFences() call, which blocks about 16 milliseconds normally (for vsync?), but in the background waits 1500 milliseconds.

I _presume_ this is a MoltenVK bug (or possibly intentional feature...?) and that the MoltenVK demos just don't wait on a fence.

I'll look a little further, but I don't think this is an SDL bug at the moment.

--ryan.
Comment 2 Diego 2019-06-24 04:11:50 UTC
Thanks for taking a look! It could be a MoltenVK bug but that wasn't my initial feeling. The LunarG/MoltenVk demo cube.c does use fences and vsync. I can't get my SDL window to show promptly from the background whether or not I'm using vsync, or using fences or just waiting for queue idle.

https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blob/master/demos/cube.c