godotengine / godot

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

Performance significantly worse when Godot is opened while VRAM is near full. #59222

Open CheesecakeCG opened 2 years ago

CheesecakeCG commented 2 years ago

Godot version

4.0 9d732aa0c

System information

Arch Linux, KDE 5.24.3, Mesa 21.3.7, AMD Radeon RX 460 2GB, Kernel 5.16.14-zen1-1-zen

Issue description

When opening Godot after opening other 3D applications, including the editor, the game will run very slowly with lots of input latency. This seems to have something to do with the VRAM usage, since the GPU "Graphics Pipe" usage is near zero with no windows focused, but the VRAM usage is ~75% when new Godot instances become completely unusable.

Steps to reproduce

  1. Open the editor or launch a game, it will run normally.
  2. Open any VRAM heavy 3D application, (Firefox, KWin Compositing, the Godot editor included)
  3. Open the editor or launch a game, it will be very laggy, the first instance of Godot (and other programs) will still be butter smooth.

Minimal reproduction project

No response

clayjohn commented 2 years ago

I'm not sure that there is anything actionable here. Godot can't really control what other applications you open before it.

Are you hoping for a warning when opening a project with little system resources available?

Calinou commented 2 years ago

AMD Radeon RX 460 2GB

With only 2 GB of VRAM, it's likely best to stick to the Vulkan Mobile backend in your projects. It should use less VRAM compared to the Vulkan Clustered backend. You can change the backend in the project settings, but keep in mind some 3D features won't work (or are currently broken).

but the VRAM usage is ~75% when new Godot instances become completely unusable.

75% of 2 GB means that there's only ~512 MB left for the running Godot project (assuming the editor is already running at this point). This is very little to work with for a modern 3D engine, even when targeting a low resolution.

KWin Compositing

It's probably a good idea to disable compositing while running Godot to improve performance, even if your VRAM isn't full. Alt + Shift + F12 lets you toggle compositing on and off.

CheesecakeCG commented 2 years ago

I'm not sure that there is anything actionable here. Godot can't really control what other applications you open before it.

Are you hoping for a warning when opening a project with little system resources available?

No, I wasn't entirely sure if this was a bug, the behavior just seemed odd, I've never seen any other program act like this. Normally, if I'm running out of VRAM and that one application using more VRAM than available has poor performance, it doesn't matter what order I open things in. This doesn't seem to affect Blender (I can open Blender before or after I open Godot and Firefox without issue)

@Calinou

You can change the backend in the project settings, but keep in mind some 3D features won't work (or are currently broken).

I just tried this, the mobile backend doesn't seem to have a noticeable performance drop off as the clustered backend when launching with the VRAM full (90% this time). I'll try with a more minimal project next to see it's a specific feature causing this.

CheesecakeCG commented 2 years ago

test project.zip

And for comparison, glxgears with vsync disabled:

And Blender with the "Temple" EEVEE demo scene.

While I was trying to test Blender in the same way, I found that if you let Blender fill up the system memory and VRAM at the same time, close Blender, then for a brief few moments the VRAM usage will drop down to ~10%, then I can launch the Godot project and have it run smoothly without closing anything else. So.. I guess that's a work around for now.