godotengine / godot

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

Godot 4 extremely slow with Vulkan drivers #83225

Closed nightblade9 closed 11 months ago

nightblade9 commented 1 year ago

Godot version

v4.0.stable.mono.official

System information

Issue description

Godot 4 seems extremely slow - for example, when I click on the Editor menu, it takes around five seconds for it to respond. Similarly, clicking the X to close Godot, takes a long time. Everything takes a long time.

I did some quick googling, and tried running it with --rendering-driver opengl3. This seems to resolve the problem. From which I understood, that this is somehow related to my Vulkan drivers.

I recently went through a lot of drama for reinstalling the latest Vulkan drivers on my system. I'm fairly sure I got it right (TL;dr DOTA2 used to terminate with an obscure graphics error on run, and now it runs fine), but I could be wrong.

If this is the wrong channel for getting help with my issue, please redirect me to the appropriate one.

Steps to reproduce

Launch Godot. Click on any menus, X button, CTRL+SHIFT+O and type something (see how it takes a couple of seconds to respond to everything).

Minimal reproduction project

Not required.

Calinou commented 1 year ago

This is likely because Godot is using llvmpipe instead of hardware-accelerated Vulkan. Run Godot from a terminal and look at the output.

clayjohn commented 1 year ago

This is likely because Godot is using llvmpipe instead of hardware-accelerated Vulkan. Run Godot from a terminal and look at the output.

And then paste the output here for us to see please

nightblade9 commented 1 year ago

And then paste the output here for us to see please

For most of the instances where I clicked on a menu and it made me wait, I didn't see any output. Towards the end though, some errors appeared.

 ./Godot_v4.0-stable_mono_linux.x86_64                                                                         
Godot Engine v4.0.stable.mono.official.92bee43ad - https://godotengine.org
libGL error: glx: failed to create dri3 screen
libGL error: failed to load driver: nouveau
OpenGL API 4.6 (Core Profile) Mesa 23.1.9-manjaro1.1 - Compatibility - Using Device: Intel - Mesa Intel(R) UHD Graphics (CML GT2)

Editing project: /home/nb/code/customizable-jrpg/source
Godot Engine v4.0.stable.mono.official.92bee43ad - https://godotengine.org
~/utils/godot-4.0.0 Vulkan API 1.3.242 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1650 Ti            

WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
     at: _editor_init (modules/gltf/register_types.cpp:70)
Loading GdUnit4 Plugin success
GdUnit4: Test server successfully started checked port: 31002
Scan for GdUnit4 Update ...
Unload GdUnit4 Plugin success
ERROR: Timer was not added to the SceneTree. Either add it or set autostart to true.
   at: start (scene/main/timer.cpp:109)
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/templates/self_list.h:106)
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/templates/self_list.h:106)
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object/object.cpp:1982)
ERROR: Resources still in use at exit (run with --verbose for details).
   at: clear (core/io/resource.cpp:489)
ERROR: Pages in use exist at exit in PagedAllocator: N7Variant5Pools12BucketMediumE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:140)
ERROR: Pages in use exist at exit in PagedAllocator: N7Variant5Pools11BucketSmallE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:140)
clayjohn commented 12 months ago

@nightblade9 Can you try again without the GDUnit4 plugin enabled and see if that helps?

nightblade9 commented 12 months ago

@nightblade9 Can you try again without the GDUnit4 plugin enabled and see if that helps?

Yep. The problem reproduces, even with a brand-new, empty project.

If it matters, attached is the zip of my empty project, and the log.

Test.zip

Godot Engine v4.1.2.stable.official.399c9dc39 - https://godotengine.org
libGL error: glx: failed to create dri3 screen
libGL error: failed to load driver: nouveau
OpenGL API 4.6 (Core Profile) Mesa 23.1.9-manjaro1.1 - Compatibility - Using Device: Intel - Mesa Intel(R) UHD Graphics (CML GT2)

Editing project: /tmp/Test
Godot Engine v4.1.2.stable.official.399c9dc39 - https://godotengine.org

---

Vulkan API 1.3.242 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1650 Ti                                ✔ 

WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
     at: _editor_init (modules/gltf/register_types.cpp:73)
nightblade9 commented 11 months ago

Any updates on this?

I'm happy running Godot from the CLI with OpenGL. Vulkan is painfully unusable at this point.

Did anyone else report this? If not, it could be an issue specific to my hardware or drivers.

akien-mga commented 11 months ago

Can you test other Vulkan projects and run tests like vulkaninfo and vkcube?

nightblade9 commented 11 months ago

Can you test other Vulkan projects

Can you provide some examples?

sonic2kk commented 11 months ago

vulkaninfo and vkcube were the examples, you can run them from the commandline 🙂

sonic2kk commented 11 months ago

For this issue, on the compatibility renderer, isn't it using the iGPU?

OpenGL API 4.6 (Core Profile) Mesa 23.1.9-manjaro1.1 - Compatibility - Using Device: Intel - Mesa Intel(R) UHD Graphics (CML GT2)

But Vulkan is using the Nvidia GPU:

Vulkan API 1.3.242 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1650 Ti

I don't know if this is expected of this issue, but I would imagine it would be interesting to know the performance with OpenGL and Vulkan with both the iGPU and dGPU (as the Intel GPU will use Intel's ANV driver as part of Mesa, and the Nvidia GPU will use the proprietary Nvidia driver).

I'm not at my PC at the moment, but fwiw the latest Godot 4 (4.1.2?) worked fine on my Arch PC as of a few days ago, with an AMD 7900XTX and Mesa 23.2.1, though that's a single GPU system and I don't have any dual GPU systems to test on.

nightblade9 commented 11 months ago

I don't know if this is expected of this issue, but I would imagine it would be interesting to know the performance with OpenGL and Vulkan with both the iGPU and dGPU (as the Intel GPU will use Intel's ANV driver as part of Mesa, and the Nvidia GPU will use the proprietary Nvidia driver).

I don't understand what this means.

Anecdotally, the performance on Vulkan is very poor (4-5s wait times to click on anything) and the performance with OpenGL is normal/good/expected. If I'm completely misunderstanding your question, feel free to rephrase it or provide detailed steps/tests you would like me to perform.

1) Results of vulkaninfo: vulkan.txt. Note that it segfaults (zsh: segmentation fault (core dumped) vulkaninfo > /tmp/vulkan.txt). 2) Results of vkcube: Selected GPU 0: NVIDIA GeForce GTX 1650 Ti, type: DiscreteGpu. Plus, this smoothly-spinning cube:

image

I'm not at my PC at the moment, but fwiw the latest Godot 4 (4.1.2?) worked fine on my Arch PC as of a few days ago, with an AMD 7900XTX and Mesa 23.2.1, though that's a single GPU system and I don't have any dual GPU systems to test on.

I'm pretty new to Manjaro, Vulkan, and dual-GPU systems, but I suspect this is the root cause of the problem. I probably don't have the right drivers working or something. (Anecdotally: DOTA 2 didn't launch and crashed with a cryptic graphics error message. I uninstalled video-linux and it started working. I reinstalled video-linux and it kept working.)

Please let me know if there's anything else you would like me to do/provide.

nightblade9 commented 11 months ago

For different reasons, I booted into Manjaro from the latest USB today. Godot seems to run smoothly. Here's what the console output says:

Godot Engine v4.1.2.stable.official.399c9dc39 - https://godotengine.org
OpenGL API 4.6 (Core Profile) Mesa 23.1.9-manjaro1.1 - Compatibility - Using Device: Intel - Mesa Intel(R) UHD Graphics (CML GT2)

Editing project: /tmp/Tmp
Godot Engine v4.1.2.stable.official.399c9dc39 - https://godotengine.org
Vulkan API 1.3.246 - Forward+ - Using Vulkan Device #0: Intel - Intel(R) UHD Graphics (CML GT2)

I noticed that - contrary to what I posted earlier - it's now using the Intel GPU instead of the NVidia one.

I don't know if this is helpful in any way, other than to suggest that I should reimage my Manjaro install and not touch the drivers. Maybe that will Just Work :tm:. I'll lose a lot of personal files, though, if I go that route.

akien-mga commented 11 months ago

It does sound like a driver setup issue. The intel integrated GPU you have is too old to support Vulkan properly. And it seems your Nvidia GPU is configured to use the badly performing nouveau open source driver, and not the proprietary ones from Nvidia. So it won't work well for either OpenGL or Vulkan.

nightblade9 commented 11 months ago

OK, thanks. Since it's very specific to my setup, I don't see any value in keeping this open any further. Feel free to reopen if you see something of value to do here.

Calinou commented 11 months ago

And it seems your Nvidia GPU is configured to use the badly performing nouveau open source driver, and not the proprietary ones from Nvidia. So it won't work well for either OpenGL or Vulkan.

Comet Lake IGPs (found on 10th-gen Intel CPUs) do have full Vulkan 1.2 support, like anything made since Skylake. Their drivers are EOL because Intel drivers go EOL really fast though.

Also, Nouveau lacks any form of Vulkan support in its stable releases, so I doubt it's related to that. (Its GPU name would also report differently compared to the NVIDIA driver.)

I still think it's related to a system configuration issue but I wouldn't be able to know exactly.

frederickjjoubert commented 4 months ago

Why is this closed? This is still a problem.

I ran into the same problem running Godot v4.2.1 on my PopOS machine.

I have an NVIDIA 2080 Ti for context with the latest v550 drivers.

When I run the default launcher for Godot 4 (which I assume uses Vulkan drivers) the editor is unusably slow.

When I run godot4 --rendering-driver vulkan same thing it's super unusably slow.

When I run godot4 --rendering-driver opengl3 then the editor works perfectly and it's buttery smooth running at the full 144 fps of my monitor.

nightblade9 commented 4 months ago

It's closed because it's a driver issue. Not specific to Godot.

Calinou commented 4 months ago

When I run the default launcher for Godot 4 (which I assume uses Vulkan drivers) the editor is unusably slow.

The project manager always uses OpenGL unless told to use Vulkan with --rendering-driver vulkan.

Do other Vulkan apps run smoothly on your system? Do you have any Vulkan overlays such as vkBasalt or MangoHud?