godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.37k stars 19.23k forks source link

Godot 4.3.beta1 editor lagging even on empty project with VRR enabled in Nvidia profile #93155

Open PauliusMM opened 2 weeks ago

PauliusMM commented 2 weeks ago

Tested versions

4.3.beta1

System information

Windows 11, RTX 3080, AMD 5800X3D

Issue description

For some reason 4.3.beta1 is lagging a lot, I am getting VRR balck screen flashes and while checking FPS it constantly jumps 40-175, while 4.3.dev6 is totally fine, framerate never drops

Steps to reproduce

Use 4.3.beta1

Minimal reproduction project (MRP)

N/A

JekSun97 commented 2 weeks ago

Please provide a video if possible, this is difficult to test. Starting from version 4.0, the editor actually has worse performance compared to version 3

PauliusMM commented 2 weeks ago

This is the 4.3.dev6

https://github.com/godotengine/godot/assets/12417513/530d9bd5-8671-4020-9a7c-ce7a675dd6a6

This is the 4.3.beta1

https://github.com/godotengine/godot/assets/12417513/7508ae83-9084-4c96-9e9e-5e5497b84a8e

something on the 4.3.beta1 triggers VRR, while on 4.3.dev6 it's perfectly fine, one solution kinda mitigated these flashes was to enable continues updating

at one point 4.3.beta1 even forced my monitor tu turn off VRR, probably crash or something

also I saw small thing that resizing window on 4.3.dev6 gave avg ~21fps, while on 4.3.beta1 it was ~12fps on empty project

Calinou commented 2 weeks ago

I suggest enabling VRR for fullscreen applications only, which is the default in the NVIDIA Control Panel. Enabling VRR for windowed applications comes with a bunch of caveats like this one; only use this option if you're OK with the downsides, or your monitor has a particularly good VRR implementation.

With VRR disabled, can you check the CPU/GPU utilization when running the Godot editor with Update Continuously enabled on both 4.3.dev6 and 4.3.beta1?

@PauliusMM Remember that for GitHub video previews to work, you need to have a blank line before and after the video URL. I edited your post accordingly, but remember to do this in the future :slightly_smiling_face:

PauliusMM commented 2 weeks ago

Sorry for the video mistakes

It would be totally fine with disabling VRR if this happened on all versions of 4.*, I even decided to test 4.2.stable and it is fine, VRR barely triggers at all, nothing similar happens like 4.3.beta1 where even when the window does nothing the framerate is jumping while on other versions VRR triggers only when a stuff is being interacted which is fine as it's not constant like 4.3.beta1 and no black flashes appear, maybe some kind of constant redrawing is happening in 4.3.beta1

From performance checks nothing much unusual, seems to be similar in all version maybe 4.3.beta1 has lower GPU usage when constantly resizing window with more small spikes, but it's hard to tell, cpu usage is very similar in all versions

PauliusMM commented 2 weeks ago

Big update, so it seems disabling the new setting v-sync mode in editor settings and relaunching the editor (as changing to disabled without relaunching does nothing) fixed all the problems, even with VRR jumping up and down, no more black flashes and made window resizing super smooth

clayjohn commented 2 weeks ago

@PauliusMM When you say you disabled the new setting v-sync mode. Are you saying that you set the project setting vsync_mode to VSYNC_DISABLED. In other words you simply disabled vsync?

I am a bit confused as Vsync is not a new setting

edit: I looked through the changelog and have found 1 potential culprit: https://github.com/godotengine/godot/pull/85188

Calinou commented 2 weeks ago

See also https://github.com/godotengine/godot/pull/48364. Since that PR was merged, the V-Sync project setting no longer affects the editor.

PauliusMM commented 2 weeks ago

I am talking about the editor vsync settings

image

Calinou commented 1 week ago

These options look relevant in NVIDIA Profile Inspector:

1

2

3

Could anyone on an affected monitor test this on the Godot profile that Godot creates on its first startup? I can't reproduce this issue locally.

cc @aitorciki

aitorciki commented 5 days ago

My setup: LG Oled + Windows 11 + Nvidia 2070 Super.

Using VRR only in full screen mode (recommended for Windows, as windowed mode is known to be buggy), I can't replicate the issue.

Forcing VRR also in windowed mode replicates the issue though (not the black flashes, but refresh rate is unstable and randomly jumping between 40fps and my setup target 60fps).

Setting Godot's Nvidia profile's GSYNC Application Mode to Fullscreen only as proposed by @Calinou solves the issue in my case.

aitorciki commented 5 days ago

@Calinou I've put together a quick and dirty hack to test forcing only-fullscreen G-SYNC in the NVIDIA Godot profile, it works: even if I setup the driver to perform VRR on full-screen and windowed modes, Godot won't trigger VRR when windowed, solving the FPS fluctuations when using the editor.

Would you like me to tidy it and up and make a PR?

aitorciki commented 5 days ago

I've gone ahead and created a PR to discuss there: https://github.com/godotengine/godot/pull/93737