When moving the cursor I get lots of stuttering due to PeekMessage slowness and the severity is worsened by mouse dpi. I have tried many configurations including: initial WM_MOUSEMOVE drain, buffered raw input, filtering WM_INPUT/WM_MOUSEMOVE, capped PeekMessage calls, and different window properties but none are able to fully fix the issue.
According to a profiler it is caused by individual PeekMessage calls unusually taking >1ms. Currently on my buffered raw input setup with filtering, lots of WM_NCHITTEST(0x84) spam to WndProc occurs during a single PeekMessage call.
Any help will be greatly appreciated because I have spent weeks trying to solve this.
I managed to make the stuttering much less severe by peeking a WM_MOUSEMOVE message every frame before event loop so that WM_NCHITTEST doesn't pile up. No longer getting the 20-50ms spikes from before but eating 1-5ms every frame for win32 events still feels wrong.
Someone asked a similar question in the discord some times ago, but I can't find it. Maybe you could asked there, because there isn't much traffic here anymore.
Have you tried using SDL to see if the problem is also present there, and if not, look at how they do it ? They seemed to have a similar issue at some point: https://github.com/libsdl-org/SDL/issues/4801
Yeah might post on the discord once I recover from the burnout of this issue. I have tried looking at SDL source code since my previous SDL games don't have the issue but they seem to be doing lots of crazy stuff like dedicated thread for raw input and such. Still have yet to profile and debug what their normal WM_MOUSEMOVE flow does but could be a solution there.