Skip to content

Commit 74ddef6

Browse files
liam-middlebrookivyl
authored andcommitted
proton: Populate NVIDIA_WINE_DLL_DIR when available
NVIDIA-software may check the environment variable `NVIDIA_WINE_DLL_DIR` for a path where DLLs provided by the NVIDIA Linux driver can be found. This is done as a fallback for when the "DriverStore" cannot be detected via the D3DDDI functions for querying an adapter-specific registry key. Tested with an application that reads `NVIDIA_WINE_DLL_DIR` from the environment and tries to load a known DLL from it. As expected manually setting the environment variable to the on-disk location did not work, as the path is not accurate within the pressure-vessel environment. Link: #8087
1 parent 4d9c9e1 commit 74ddef6

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

proton

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,11 +1071,14 @@ class CompatData:
10711071

10721072
# Try to detect known DLLs that ship with the NVIDIA Linux Driver
10731073
# and add them into the prefix
1074-
nvidia_wine_dll_dir = find_nvidia_wine_dll_dir()
1075-
if nvidia_wine_dll_dir:
1074+
if g_session.nvidia_wine_dll_dir:
10761075
for dll in ["_nvngx.dll", "nvngx.dll"]:
1077-
try_copy(nvidia_wine_dll_dir + "/" + dll, "drive_c/windows/system32", optional=True,
1078-
prefix=self.prefix_dir, track_file=tracked_files, link_debug=True)
1076+
try_copy(g_session.nvidia_wine_dll_dir + "/" + dll,
1077+
"drive_c/windows/system32",
1078+
optional=True,
1079+
prefix=self.prefix_dir,
1080+
track_file=tracked_files,
1081+
link_debug=True)
10791082

10801083
setup_game_dir_drive()
10811084
setup_steam_dir_drive()
@@ -1548,6 +1551,17 @@ class Session:
15481551
if "PROTON_CRASH_REPORT_DIR" in self.env:
15491552
self.env["WINE_CRASH_REPORT_DIR"] = self.env["PROTON_CRASH_REPORT_DIR"]
15501553

1554+
# NVIDIA software may check for the "DriverStore" by querying the
1555+
# NGXCore\NGXPath registry key via `D3DDDI_QUERYREGISTRY_SERVICEKEY` for
1556+
# a given adapter. In the case where this path cannot be found, the
1557+
# `NVIDIA_WINE_DLL_DIR` environment variable is read as a fallback.
1558+
#
1559+
# TODO: Add support for populating NGXCore\NGXPath so we can remove the
1560+
# NGX copies done in setup_prefix(), and this environment variable.
1561+
self.nvidia_wine_dll_dir = find_nvidia_wine_dll_dir()
1562+
if self.nvidia_wine_dll_dir:
1563+
self.env["NVIDIA_WINE_DLL_DIR"] = self.nvidia_wine_dll_dir
1564+
15511565
if "PROTON_LOG" in self.env and nonzero(self.env["PROTON_LOG"]):
15521566
if self.setup_logging(append_forever=False):
15531567
self.log_file.write("======================\n")

0 commit comments

Comments
 (0)