-
Notifications
You must be signed in to change notification settings - Fork 428
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
Stuttering on Windows (windowed) #1628
Comments
I don't get any stuttering. wdym? |
Does that mean you had stuttering in fullscreen that this prevents? Or it just doesn't do anything negative in fullscreen on your system? Was that with desktop-fullscreen or exclusive fullscreen, or both? |
One thing I did notice is using timer.getTime() for physics updates leads to jitter so I fixed that to the screen refresh rate. Never seen any fps problems though. Maybe try logging an fps counter's results and post them here? |
This is off-topic but that sounds like a bad idea.. for example I use a 120hz monitor and a 60hz monitor on one of my computers. I would expect all games to run at the same rate no matter which monitor the game is in. The typical approach to stable physics simulation is to use an accumulator method to run physics at a fixed rate without depending on frame rate. |
So if you move the window between those two monitors, the refresh rate will change? That's interesting. Yeah, I might look into that. |
"It works" means "it makes 60fps on fullscreen with love-vsync off" also stuttering is disabled, instead of "love makes >9000fps burst on fullscreen". UPD: Stuttering does not appears on desktop fullscreen mode, because DWM is works in another mode. Borderless window leads to stuttering just like a regular window. |
You might not have noticed it. Also you can check it with modified love.run: if love.graphics and love.graphics.isActive() then
love.graphics.origin()
love.graphics.clear(love.graphics.getBackgroundColor())
if love.draw then love.draw() end
love.graphics.present() -- add another present
love.graphics.present() -- and it starts looks stroboscopic
end With DwmFlush-present it looks ok. |
The issue is specific to certain GPUs and graphics drivers, I believe. |
I checked it with:
It also appears on my friends' Radeons. The problem is Windows desktop window manager, it's not synced with sdl-window vsync. GLFW also added DwmFlush in this commit |
i have the same issue on I'm sure the problem has something to do with GC, but I am not very clear about this problem, so I think it can be used as the third delivery library to distribute it to people who have problems running on widnews at least. |
On Win7 x64 with GTX1650 latest drivers, this completely eliminated my visual (micro?)stutter issues... with or without löve's vsync being set to 0 or not, since this will force sync to 60Hz (maybe it'll force it to other values if other screens are set to use different refresh rates? i couldn't test that). Tested in windowed mode as well. The only issue with it is that it does introduce momentary stutter when the window is un/re-focused, or if it's moved by mouse, which didn't happen without it. |
I haven't been able to reproduce the issue to the degree that it happens in those gifs (that likely has to do with other things being composited on your system etc), but I've put in a change to use it here: 5dd4a46 It seems very delicate in terms of potential side effects, so I'd appreciate any sort of testing anyone wants to do. It only activates in windowed mode and desktop-fullscreen (not exclusive fullscreen), and only when non-adaptive vsync is enabled. A build with it should be available here shortly: https://ci.appveyor.com/project/AlexSzpakowski/love/builds/35477235 |
5dd4a46 caused heavy stuttering in my laptop running Windows 10 2004 using integrated graphics (Intel HD Graphics 620 with 27.20.100.8681 driver). Printing the delta time to console, I can see it eratically alternate between 16.67ms and 33.33ms like
This does not happen when using dGPU or iGPU without that commit applied. |
Thank you, I will test it with all my stuff and a lot of people and also if something goes wrong, I will look for a better solution (set of solutions?). |
It looks like two sync systems fighting: Love waits love-vsync (one frame) then dwm (second frame), and it alternates with normal rendering when it makes it in time. |
I'll probably have to revert the change, missing vsync on some systems isn't worth it.
Unfortunately turning vsync off and using DwmFlush as "vsync" isn't going to work - for example on my computer, DwmFlush syncs to my primary monitor's 120hz refresh rate no matter which display the window is on, but I have 60hz secondary monitors which vsync correctly syncs to when the window is in one of those displays. Plus, ultimately whether OpenGL's vsync is on or off is controlled by users via system graphics driver settings. Apps can only set a hint for what the driver should prefer if users leave it up to apps instead of overriding it. |
Love2d with or without vsync has issues with render stuttering/jittering (may be checked with double love.graphics.present: rendered stuff looks like stroboscope) because Windows DWM gets frames in unknown timing.
Some people sync opengl/dx apps with DwmFlush:
https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmflush
And it works (also on fullscreen apps)
I use it with ffi:
But it may be useful if someone puts it in LOVE.
The text was updated successfully, but these errors were encountered: