godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Show warning window when Godot4 running not on "physical discrete GPU" especially when used CPU-translation for Vulkan #8071

Open danilw opened 11 months ago

danilw commented 11 months ago

Describe the project you are working on

Just observation of what hardware people tried to use/launch Godot4.

Describe the problem or limitation you are having in your project

https://github.com/godotengine/godot/issues/82063

And I seen in many redit/other social forum thread - people even trying to run Godot4 in VM like WSL... and then they complaining about low speed of rendering.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Show warning/notification window in Godot 4 Editor or/and on startup when used non-discrete GPU, especialy when used CPU emulation like mesa-lavapipe.

Also print similar warning to debug-output console.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This is extremely simple to make:

  1. Vulkan GPU report "its type" VkPhysicalDeviceType VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, - so only single exception when this "warning" not shown.
  2. Integrate Vulkan GPU id from https://vulkan.gpuinfo.org/ using VkPhysicalDeviceProperties that return apiVersion driverVersion vendorID deviceID - compare this data to "known GPU DB" - and show warning if GPU is unknown.
  3. just show popup window when GPU-data is not correct.

If this enhancement will not be used often, can it be worked around with a few lines of script?


Is there a reason why this should be core and not an add-on in the asset library?

it core functional of Editor

danilw commented 11 months ago

Current mesa-lavapipe ID in Linux is:

deviceType = CPU deviceName = llvmpipe (LLVM 15.0.7, 256 bits) deviceID = 0x0000 vendorID = 0x10005 driverVersion = 0x0001 apiVersion = 0x4030EE

To launch Godot 4 in mesa-CPU drivers:

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.i686.json:/usr/share/vulkan/icd.d/lvp_icd.x86_64.json ./Godot_v4.1.1-stable_linux.x86_64

And after opening project in Godot console youl see:

Vulkan API 1.3.238 - Forward+ - Using Vulkan Device #0: Unknown - llvmpipe (LLVM 15.0.7, 256 bits)

or same after pressing Play, middle bottom of screenshot text output: image

Calinou commented 11 months ago

Vulkan reports a device type, so we don't need to read the device name. We can just check on startup whether it's the CPU or virtual (i.e. VM-provided) device type. OpenGL will require reading the device name though – checking for llvmpipe should do the trick.

Regarding how to warn the user about this, I suggest using an editor toast on startup and a warning in console in running projects. This can be done using WARN_PRINT_ED(). A blocking alert dialog, while the most visible option, is probably too much as it'll also mess with automation scripts.