@cmuratori I have a question that unfortunately was too late for handmade hero today: In windows, window movement has 0 latency compared to the hardware mouse cursor. It follows pixel perfect. How does it do that? My own imgui has visible latency with vsync off and 0.2 ms frames.
-
-
Replying to @pulp_user
It's because Windows' compositor is handling the mouse cursor _and_ the windows, and it makes sure not to sink an update without updating both. If you switched to fullscreen rendering and rendered your own mouse cursor, it wouldn't lag either :)
1 reply 0 retweets 1 like -
Replying to @cmuratori @pulp_user
Of course, you might _also_ be doing something wrong elsewhere. So be sure to check that you're using the most up-to-date mouse positions when you render. But fundamentally, there's not much you can do to ensure that Windows doesn't update the cursor location in between.
1 reply 0 retweets 1 like -
Replying to @cmuratori
Thanks for the quick answer! I guess increasing the latency of the cursor to match the latency of the ui is one way :D unfortunately it doesn't really help in the persuit of lower latency over all.
2 replies 0 retweets 0 likes -
Replying to @pulp_user
No, that is not what is happening in either case. What I am saying is that you have a nyquist problem, which is that Windows and you are not synchronized. So when you get the cursor pos and then sink a frame, you don't know if Windows is "off beat" from you and moves the cursor.
1 reply 0 retweets 0 likes -
Replying to @cmuratori @pulp_user
There is no "increased latency" in either case, it is just an update timing problem. Since Windows is updating the cursor when _it_ wants, it can guarantee that the update doesn't happen in the middle of _its_ frame, but it can't do that for _your_ frame. Make sense?
1 reply 0 retweets 0 likes -
Replying to @cmuratori @pulp_user
You can improve the situation for yourself by polling for the mouse more aggressively, and doing it right at the very end of everything you do, so it's as close to the SwapBuffers/Present as possible. But you can't do what Windows does, which is make sure that it's never off.
1 reply 0 retweets 0 likes -
Replying to @cmuratori
Makes sense! I phrased that badly, I didn't mean to say that the cursor had increased latency, only that it would show the actual application latency, which is always more than windows' latency. Pushing everything close to Present would be less effective, the shorter my frames...
1 reply 0 retweets 0 likes -
Replying to @pulp_user @cmuratori
are, right? Since the present call happens further from the actual monitor swapping images. So ideally the frame would start as late as possible to call present right before the monitor is about to switch, only that I cant know when that will be, and how long the frame will take.
1 reply 0 retweets 0 likes
If you're using vsync, yeah, unless you have one of those fancy FreeSync/nSync/whatever they're called monitors that can refresh on demand.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.