-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache Vulkan physical device info to avoid stuttering during resize #182
Comments
It's quite unfortunate that |
The other thing we could do is - avoid swapchain recreation entirely for as long as possible. I.e. if the window is resized, we could allow the "suboptimal" presentation on that surface. As soon as the resize ends, we should actually recreate the surface upon seeing "suboptimal". |
Now that I re-read the issue, I'm getting more doubt. If Either way, I'm merging #183, which should resolve at least this call. Let me know if it works! |
You are right, it does not entirely fix the stuttering. The start of a resize does feel markedly more smooth though! Stuttering now only starts after around a second of continuous resize movement (and stopping for a moment makes it become smooth again.) |
Based on some quick & dirty
println!
-profiling, the culprit for Zed's clunky resize performance appears to be inContext::resize(...)
in blade-graphics' vulkan code. Further, the vast majority of time in that function appears to be spent inget_physical_device_surface_formats
(I've seen it peak over 2000µs on my system) andget_physical_device_surface_present_modes
(less bad but also frequently peaks somewhere in the order of 500µs).Both of these are querying capabilities of the physical device, which are unlikely to change and as such should be trivial to cache. In the event that they change (e.g. due to the window to another monitor that is attached to a different GPU? Or the display mode getting changed while the application is running?) I believe swapchain creating would either fail or presenting would throw a "suboptimal swapchain" or similar error that can be used to force re-querying those device attributes.
The text was updated successfully, but these errors were encountered: