Vsync does not work in fullscreen
Godot version
4.1 stable
System information
Godot v4.1.stable unknown - Arch Linux #1 SMP PREEMPT_DYNAMIC Thu, 06 Jul 2023 18:35:54 +0000 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (nvidia; 535.54.03) - AMD Ryzen 7 3700X 8-Core Processor (16 Threads) - NVidia GeForce RTX 3060 ti
Issue description
Vsync works as expected when in windowed mode. When in fullscreen, however, Vsync seems to be ignored.
Steps to reproduce
create an empty scene and print the current fps. Playing in windowed mode with vsync enabled in project settings reveals the expected 60 FPS. Changing the mode to fullscreen however causes FPS to jump to crazy amounts even with Vsync enabled.
Minimal reproduction project
N/A
I tried this on windows 10 with 4.1 and it doesn't jump crazy for me but window at teh same resolution as the fullscreen is more stable at 60fps for me than exclusive/fullscreen for some reason (windowed at 1920x1080 has 60 fps stable at a static scene with a mesh and a camera 3D) while the same res for fullscreen as well as exclusive fullscreen oscilates 58-62 fps.
What's the refresh rate of your monitor? Do you have multiple monitors? Are you on a X11 or Wayland session? Use echo $XDG_SESSION_TYPE in a terminal to know.
I'm using X11, the refresh rate of my monitor is 60hz.
Can't reproduce on Arch Linux, X11, and with an AMD RX 6500 XT:
- Tested with my monitor at both 60Hz and 144Hz
- Tested all combinations of fullscreen (WINDOW_MODE_EXCLUSIVE_FULLSCREEN & WINDOW_MODE_FULLSCREEN) and v-sync modes (all 4 modes)
- Tested when changing project settings, and when changing in runtime
I can never trigger a situation where v-sync is enabled and my FPS go beyond the screen refresh rate. Can you provide more details how you're triggering this issue? Also, can you test if this issue occurs on Godot v4.0 and v3.5?
Can't reproduce on Arch Linux, X11, and with an AMD RX 6500 XT:
* Tested with my monitor at both 60Hz and 144Hz * Tested all combinations of fullscreen (WINDOW_MODE_EXCLUSIVE_FULLSCREEN & WINDOW_MODE_FULLSCREEN) and v-sync modes (all 4 modes) * Tested when changing project settings, and when changing in runtimeI can never trigger a situation where v-sync is enabled and my FPS go beyond the screen refresh rate. Can you provide more details how you're triggering this issue? Also, can you test if this issue occurs on Godot v4.0 and v3.5?
I'm creating an empty scene in an empty project. I'm creating a script and attatching it to a Node2D. This script just prints the current fps to the console using Engine.get_current_frames_per_second() in _process(). I then change the window mode in project settings > window and setting it to fullscreen / exclusive fullscreen with Vsync set to enabled. In both fullscreen options I get an fps well over 3 thousand, but if I set the window mode to windowed it drops to the expected 60.
This issue also occured for me in godot v4.0.
Can you try switching render backends on the top-right corner to see if this issue happens on other modes as well?
The issue persists under Forward+ and Mobile, but Vsync seems to work under fullscreen when using Compatibility.
The issue persists under Forward+ and Mobile, but Vsync seems to work under fullscreen when using Compatibility.
Could be a Vulkan-specific issue then (Compatibility runs under OpenGL while the others run under Vulkan IIRC). I tried looking through similar issues, but can't find much, other than to check in Nvidia control panel if you don't have any setting overriding V-Sync (https://github.com/godotengine/godot/issues/68845#issuecomment-1320479762)
Additionally, you could try running under MangoHud (arch package) to double-check the FPS values, and also enforce VSync externally:
$ MANGOHUD_CONFIG=vsync=3 mangohud godot --path <path/to/your/project.godot>
This should force VSync to be enabled; if it doesn't work, I think it's more likely that the issue is coming from some Nvidia config, rather than Godot.
Whoops, yeah your right it was totally my graphics settings. Weird Vsync worked with OpenGL and not Vulkan but whatever. Thanks anyways!
Whoops, yeah your right it was totally my graphics settings. Weird Vsync worked with OpenGL and not Vulkan but whatever. Thanks anyways!
I'm surprised you found a way to forcibly disable V-Sync if the app requests it on Linux (even on NVIDIA). No graphics driver I know of on Linux provides this option; you can only forcibly enable V-Sync. This is the default behavior on Intel, and provided as the Sync to VBlank option on NVIDIA.
The NVIDIA Windows driver does have a setting to forcibly disable V-Sync though.