From 3e05e9bb1a74de7e1414bdb38726fe97ddcef1e5 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 17 May 2018 16:37:43 -0500 Subject: [PATCH] proton: Use DXVK by default, add PROTON_USE_WINED3D11 switch --- README.md | 13 +++++++------ proton | 33 ++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 6a7a575e..fec18878 100644 --- a/README.md +++ b/README.md @@ -133,17 +133,18 @@ submodule and directory for details. ---- Runtime Config Options ---- -Proton can be tuned at runtime to help certain games run. Options can either -be defined in a comma-separated list stored in the STEAM_COMPAT_CONFIG -environment variable when running Proton (the Steam client does this), -or passed through the presence of individual environment variables as documented below. +Proton can be tuned at runtime to help certain games run. The Steam client sets +some options for known games using the STEAM_COMPAT_CONFIG variable. +You can override these options using the environment variables described below. +To enable an option, set the variable to a non-0 value. To disable an +option, set the variable to 0. All of the below are runtime options. They do not effect permanent changes to the Wine prefix. Removing the option will revert to the previous behavior. | Compat config string | Environment Variable | Description | | :-------------------- | :----------------------------- | :----------- | -| dxvk | PROTON_USE_DXVK | Run the game with DXVK instead of wined3d. | -| nod3d11 | PROTON_NO_D3D11 | Disable d3d11.dll, for games which can fall back to and run better with d3d9. | +| wined3d11 | PROTON_USE_WINED3D11 | Use OpenGL-based wined3d instead of Vulkan-based DXVK for d3d11. | +| nod3d11 | PROTON_NO_D3D11 | Disable d3d11.dll, for games which can fall back to and run better with d3d9. | diff --git a/proton b/proton index 93182bb7..bdd1d663 100755 --- a/proton +++ b/proton @@ -50,16 +50,21 @@ if not ("STEAM_COMPAT_DATA_PATH" in os.environ): log("No compat data path?") sys.exit(1) +def check_environment(env_name, config_name): + if not env_name in os.environ: + return + if os.environ[env_name] == "0" or len(os.environ[env_name]) == 0: + config_opts.remove(config_name) + else: + config_opts.add(config_name) + if "STEAM_COMPAT_CONFIG" in os.environ: - config_opts = os.environ["STEAM_COMPAT_CONFIG"].split(",") + config_opts = set(os.environ["STEAM_COMPAT_CONFIG"].split(",")) else: - config_opts = [] + config_opts = set() -if "PROTON_USE_DXVK" in os.environ: - config_opts.append("dxvk") - -if "PROTON_NO_D3D11" in os.environ: - config_opts.append("nod3d11") +check_environment("PROTON_USE_WINED3D11", "wined3d11") +check_environment("PROTON_NO_D3D11", "nod3d11") basedir = os.path.dirname(sys.argv[0]) bindir = basedir + "/dist/bin/" @@ -245,18 +250,20 @@ with prefix_lock: os.symlink(dll_dir + "/d3d11.dll", link_dir + "/d3d11.dll") os.symlink(dll_dir + "/dxgi.dll", link_dir + "/dxgi.dll") - if "dxvk" in config_opts: + if "wined3d11" in config_opts: + #use gl-based wined3d for d3d11 + make_dxvk_links(basedir + "/dist/lib64/wine/", + prefix + "drive_c/windows/system32") + make_dxvk_links(basedir + "/dist/lib/wine/", + prefix + "drive_c/windows/syswow64") + else: + #use vulkan-based dxvk for d3d11 make_dxvk_links(basedir + "/dist/lib64/wine/dxvk/", prefix + "drive_c/windows/system32") make_dxvk_links(basedir + "/dist/lib/wine/dxvk/", prefix + "drive_c/windows/syswow64") dlloverrides["dxgi"] = "n" dlloverrides["d3d11"] = "n" - else: - make_dxvk_links(basedir + "/dist/lib64/wine/", - prefix + "drive_c/windows/system32") - make_dxvk_links(basedir + "/dist/lib/wine/", - prefix + "drive_c/windows/syswow64") if "nod3d11" in config_opts: dlloverrides["d3d11"] = ""