summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2021-03-08 15:42:07 +0100
committerRémi Verschelde <rverschelde@gmail.com>2021-03-08 15:51:14 +0100
commitae850177a3cd4e285313728dfcb490753e2e7e82 (patch)
treeea216444c56a964df9a814babd7a5592693e1757 /platform
parent26d1b30d35d0897e18e4bc9521c1833eb1bdcf0c (diff)
Linux: Fix PRIME detection on Steam
To avoid trying to do PRIME detection on fake `libGL.so` as used by e.g. Renderdoc or Primus, we skip detection if there's a `libGL.so` in `LD_LIBRARY_PATH`... and our luck is that Steam defines it and includes system paths too, thus the actual system `libGL`... 🤦 So if we detect Steam, we skip this check. Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
Diffstat (limited to 'platform')
-rw-r--r--platform/linuxbsd/display_server_x11.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index d7f7054acb..3bc859e17d 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -4030,7 +4030,10 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
use_prime = 0;
}
- if (getenv("LD_LIBRARY_PATH")) {
+ // Some tools use fake libGL libraries and have them override the real one using
+ // LD_LIBRARY_PATH, so we skip them. *But* Steam also sets LD_LIBRARY_PATH for its
+ // runtime and includes system `/lib` and `/lib64`... so ignore Steam.
+ if (use_prime == -1 && getenv("LD_LIBRARY_PATH") && !getenv("STEAM_RUNTIME_LIBRARY_PATH")) {
String ld_library_path(getenv("LD_LIBRARY_PATH"));
Vector<String> libraries = ld_library_path.split(":");