-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Docking drop rectangle shaking / multiple windows don't have perfectly synchronized display #2361
Comments
Could you check in the Metrics window is the number of active viewports is changing? |
Sure, will provide some more info asap |
Yes. It looks like out of sync, and I just found out that it degrades over time (first minutes are ok!). |
Nvm the time degradation, I just happened on a fresh launch. I just found out that viewport creation is always deterministic (it always happens when dropping outside the main client window); but... the viewport destruction does not always happens when dropping a small floating tab inside the main windows client; would that explain the out of sync? |
If it changes when dropped it means this is creating a viewport, and the swap/vsync of your multiple render contexts are not in sync. It may be tricky to solve depending on your setup/driver. See how the example application are using for render/swap/vsync. Using ConfigDockingTransparentPayload=true attenuate the issue by using a different technique (make viewport transparent and using show the drop overlay on 1 of them), but it tends to need ConfigViewportsNoAutoMerge = true as well. Apparently Visual Studio is using a fullscreen transparent hwnd to bypass this problem (not sure where I got this info, it's not verified).
In Demo>Examples>Docking you can have a fullscreen dockspace. I don't think this is any related tho. |
To test how your multiple render targets are synchronized:
|
So much info. Thx. Testing all this in a few hours :D |
More feedback. |
Note that it doesn't get fixed per se, the framebuffers are still not synchronized but the way we render the drop boxed on a single layer doesn't rely on that synchronization. Are you nvidia or ATI? We ought to figure out if it is even possible to have synchronized framebuffers. EDIT Wait did you actually mean PassthruDockspace and not ConfigDockingTransparentPayload as discussed above?? |
New feedback. This is all still {1.68 wip + docking + viewports + example application + glfw3 + gl3} combo. |
Errmm.. It happens on nvidia too, it's only that app needs to be on low framerate, I guess. |
I'm also experiencing this issue. In our case, however, this happens even at high frame rates. I suspect this is because our Windows UI (message pump) thread is separate from our game thread (and thus the ImGui thread.) I suspect this causes some amount of latency between ImGui calling Lines 10485 to 10493 in 87883ab
This can be observed if you modify your rectangle test to print This screenshot was taken while moving Window A. (It's fine as long as it isn't moving.) The left-top corner of this screenshot represents the left-top corner of the primary monitor. If you measure, Window A is actually at 216, 198, but it thinks it's at 216, 194. If you measure the error in the rectangle it is 4 pixels off, which matches the discrepancy exactly. I've tried some basic mucking with how ImGui deals with platform window positions (such as skipping Unfortunately modifying the ImGui example to use a separate thread for the message pump is non-trivial, otherwise I'd make a more minimal repro with it to ensure it's not something else I'm doing. |
I haven't tried it yet but I've noticed that Vulkan allow |
I recently stumbled into the same problem while trying to switch to Windows swap chain flip presentation model. Even with V-Sync enabled, the drop rectangles can appear heavily desynchronized.
Yes, I'm pretty sure that's how Visual Studio does it because its docking UI is always drawn on top, even if there is a window from another app in the way : Wouldn't that be a good solution to fix this issue? |
I just ran into this issue, did anyone ever figure out a solution? |
Indeed, I notice this shaking when I'm on my pc with an Intel UHD Graphics 630 but I have no worries when I run on my pc with an RTX 3080 (except when I try to record the screen to show that it does not shake...) |
Having the docking indicators drawn on top as independent composited HWNDs would be pretty helpful here actually. It will be difficult to always ensure different viewports remain synchronized in a general architecture. In some engines, different windows present on disparate threads which latch at different rates to keep auxiliary UI responsive even if the main viewport suffers from scene-complexity related stutter. It's also quite difficult to manage swapchains identically in the general case, with the Vulkan WSI extension and DXGI interfaces having fairly different capabilities (waitable events/late-latching, hardware-accelerated scaling, different semantics for flip models, driver extensions for VRR, etc.). Coupled with the fact that most engines were developed with a "primary viewport" in mind, it wouldn't surprise me if the actual swapchain behavior was subtly different, even with the same graphics settings. (Note: after finding this synchronization issue in my own implementation, I tried out the DX12 example for comparison and the same issue is present there on a 2080 RTX TI) |
Hi, I've been using ImGui with docking and multi-viewport against the back-end of my own engine (linux, glfw, vulkan) and I have been experiencing this problem as well. Some things I've noticed:
Since this is all executed synchronously, it looks to me that the actual window positions are always lagging behind the ones set by imgui, but imgui is calculating it's state based on the window position it expects instead of what is actually there. To me this seems like it explains the desync behavior quite well. Acquiring and working with the actual window position would yield considerably more accurate results I'd say. You'd probably have to separate out a target position (which you update and pass to SetWindowPos) and a current position (for rendering). |
The issue is much less noticeable in the gif due to low framerate. Sorry.
Repro-steps (I think). Maximize client window. Pick any tab which is large enough. Scroll it so it overlaps right and bottom screen borders. Notice the issue. Note: I am using a single monitor setup right now.
Originally posted by @r-lyeh in #2353 (comment)
The text was updated successfully, but these errors were encountered: