godotengine / godotengine/godot
Stutters/Strange Frame Instability using Forward+/Vulkan with Vsync.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Tested in 4.5 beta 5.
Found initially in 4.4.1
### System information
Windows 11 - Vulkan / Forward+ - Nvidia RTX 3070 (driver update 580.97) - Intel i7 12700f
### Issue description
Using the forward+ renderer with VSync (either regular or GSync), while the games max fps is set to the refresh rate causes very strange stuttering issues. What will happen is that the scene will run fine but usually after a few seconds the scene will start stuttering for seconds at a time. During this time, the process delta will vary by multiple milliseconds, causing stutters. It will also make mouse input movements, such as camera control, feel like they operate at half of the desired refresh rate, whereas the moving mesh in the background seems to operate more in line with the proper refresh rate.
What triggers the stuttering is hard to tell. It usually will start acting up without any input after a few seconds. Alt tabbing in and out of the window a few times also seems to cause the stutters.
Stutters do not appear to happen when VSync is off.
Stutters do not appear to happen when D3D12 is used instead of Vulkan.
Stutters do not appear to happen if the scene operates at less than the monitors refresh rate.
Stutters can happen with Windowed, Fullscreen and Exclusive Fullscreen.
Turning off GSync, both on the monitor itself and in Nvidia control panel does not cause the stuttering to go away.
Messing with presentation mode in the Nvidia control panel does not seem to affect anything.
Increasing the physics tick rate of the project seems to worsen the delta changing. Likewise, lessening it seems to lower it.
Windows Dynamic Refresh Rate setting is not enabled, and also not available on my machine.
Here are videos of the stutters triggered by both alt tabbing and waiting. In the alt tabbing video I move the camera around with a mouse.
https://github.com/user-attachments/assets/ccf0c363-2b84-4f44-b5b8-b42d104e7ae9
https://github.com/user-attachments/assets/21b0362e-5b57-4d5b-af88-fff13b6993cb
Initially thought to be #84137 , however, I am not getting Jitters, only stutters, and upon further testing, I got it the stuttering to appear with Windowed mode, which was said to not cause the issue there.
Potentially similar to #90733 , however, I've been able to trigger the stutters with different conditions listed.
### Steps to reproduce
Use the Forward+ Renderer with Vulkan, set the Max FPS to your monitors refresh rate.
### Minimal reproduction project (MRP)
For 4.5 beta.
If using a different refresh rate, change it to match your monitors.
[stuttertest.zip](https://github.com/user-attachments/files/21820990/stuttertest.zip)
Contributor guide
Research direction
Start by running the attached stuttertest.zip project in Godot 4.5 beta with Forward+, Vulkan, VSync, and the monitor refresh rate as the maximum FPS. Compare behavior with VSync off, D3D12, or a lower FPS cap, including after alt-tabbing. Done means identifying and correcting the Vulkan timing condition so frame time and input remain stable under the reported settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100