diff --git a/README.md b/README.md index 5be95325..87050094 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ which can have [security implications](https://docs.docker.com/engine/security/security/). Starting from a stock Debian 9 installation, you will need to install the -`gpgv2`, `gnupg2`, `g++`, and `g++-6-multilib` packages from the +`gpgv2`, `gnupg2`, `g++`, `g++-6-multilib`, and `mingw-w64` packages from the Debian repos. You will also need to install `meson` version 0.43 or later, which can be [acquired from backports](https://backports.debian.org/Instructions/). Next, [install Docker-CE from the official Docker repositories](https://docs.docker.com/install/linux/docker-ce/debian/). @@ -78,6 +78,13 @@ This will pull in all of the dependencies required to run wine. You can then (and we do) uninstall the `winehq-devel` package in order to ensure that a system Wine installation does not interfere with your build process. +DXVK requires that we choose the posix alternative for the mingw-w64 compilers: + + sudo update-alternatives --set x86_64-w64-mingw32-gcc `which x86_64-w64-mingw32-gcc-posix` + sudo update-alternatives --set x86_64-w64-mingw32-g++ `which x86_64-w64-mingw32-g++-posix` + sudo update-alternatives --set i686-w64-mingw32-gcc `which i686-w64-mingw32-gcc-posix` + sudo update-alternatives --set i686-w64-mingw32-g++ `which i686-w64-mingw32-g++-posix` + Next we set up the Steam runtime build environments. Here we use the `wip-docker` branch to get access to the Docker images. diff --git a/build/makefile_base.mak b/build/makefile_base.mak index 468444a4..6d9a802f 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -230,8 +230,8 @@ STEAM_DIR := $(HOME)/.steam/root DIST_COPY_FILES := toolmanifest.vdf filelock.py proton proton_3.7_tracked_files user_settings.sample.py DIST_COPY_TARGETS := $(addprefix $(DST_BASE)/,$(DIST_COPY_FILES)) DIST_VERSION := $(DST_DIR)/version -DIST_OVR32 := $(DST_DIR)/lib/openvr_api_dxvk.so -DIST_OVR64 := $(DST_DIR)/lib64/openvr_api_dxvk.so +DIST_OVR32 := $(DST_DIR)/lib/wine/dxvk/openvr_api_dxvk.dll +DIST_OVR64 := $(DST_DIR)/lib64/wine/dxvk/openvr_api_dxvk.dll DIST_PREFIX := $(DST_DIR)/share/default_pfx/ DIST_COMPAT_MANIFEST := $(DST_BASE)/compatibilitytool.vdf DIST_LICENSE := $(DST_BASE)/LICENSE @@ -247,12 +247,12 @@ DEPLOY_COPY_TARGETS := $(DIST_COPY_TARGETS) $(DIST_VERSION) $(DIST_LICENSE) $(DIST_LICENSE): $(LICENSE) cp -a $< $@ -$(DIST_OVR32): $(SRCDIR)/openvr/bin/linux32/libopenvr_api.so | $(DST_DIR) - mkdir -p $(DST_DIR)/lib/ +$(DIST_OVR32): $(SRCDIR)/openvr/bin/win32/openvr_api.dll | $(DST_DIR) + mkdir -p $(DST_DIR)/lib/wine/dxvk cp -a $< $@ -$(DIST_OVR64): $(SRCDIR)/openvr/bin/linux64/libopenvr_api.so | $(DST_DIR) - mkdir -p $(DST_DIR)/lib64/ +$(DIST_OVR64): $(SRCDIR)/openvr/bin/win64/openvr_api.dll | $(DST_DIR) + mkdir -p $(DST_DIR)/lib64/wine/dxvk cp -a $< $@ $(DIST_COPY_TARGETS): | $(DST_DIR) @@ -830,24 +830,22 @@ DXVK_CONFIGURE_FILES32 := $(DXVK_OBJ32)/build.ninja DXVK_CONFIGURE_FILES64 := $(DXVK_OBJ64)/build.ninja # 64bit-configure -# the sed junk is to work around meson being unable to pass linker args to -# cross-file builds. -$(DXVK_CONFIGURE_FILES64): $(MAKEFILE_DEP) $(WINE_BUILDTOOLS64) | $(DXVK_OBJ64) +$(DXVK_CONFIGURE_FILES64): $(MAKEFILE_DEP) | $(DXVK_OBJ64) cd "$(DXVK)" && \ - sed -e "s|@PROTON_C_LINK_ARGS@|'-L$(abspath $(TOOLS_DIR64))/lib64', '-L$(abspath $(TOOLS_DIR64))/lib64/wine'|" \ - -e "s|@PROTON_C_ARGS@|'-I$(abspath $(TOOLS_DIR64))/include', '-I$(abspath $(TOOLS_DIR64))/include/wine', '-I$(abspath $(TOOLS_DIR64))/include/wine/windows'|" \ - < build-wine64.txt > proton-build-wine64.txt && \ - PATH="$(abspath $(SRCDIR))/glslang/bin/:$(abspath $(TOOLS_DIR64))/bin/:$(PATH)" \ - meson --libdir=lib/ --prefix="$(abspath $(DXVK_OBJ64))" --cross-file proton-build-wine64.txt --buildtype=release "$(abspath $(DXVK_OBJ64))" + PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" \ + meson --prefix="$(abspath $(DXVK_OBJ64))" --cross-file build-win64.txt "$(abspath $(DXVK_OBJ64))" + + cd "$(DXVK_OBJ64)" && \ + PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" meson configure -Dbuildtype=release # 32-bit configure -$(DXVK_CONFIGURE_FILES32): $(MAKEFILE_DEP) $(WINE_BUILDTOOLS32) | $(DXVK_OBJ32) +$(DXVK_CONFIGURE_FILES32): $(MAKEFILE_DEP) | $(DXVK_OBJ32) cd "$(DXVK)" && \ - sed -e "s|@PROTON_C_LINK_ARGS@|'-L$(abspath $(TOOLS_DIR32))/lib', '-L$(abspath $(TOOLS_DIR32))/lib/wine'|" \ - -e "s|@PROTON_C_ARGS@|'-I$(abspath $(TOOLS_DIR32))/include', '-I$(abspath $(TOOLS_DIR32))/include/wine', '-I$(abspath $(TOOLS_DIR32))/include/wine/windows'|" \ - < build-wine32.txt > proton-build-wine32.txt && \ - PATH="$(abspath $(SRCDIR))/glslang/bin/:$(abspath $(TOOLS_DIR32))/bin/:$(PATH)" \ - meson --libdir=lib/ --prefix="$(abspath $(DXVK_OBJ32))" --cross-file proton-build-wine32.txt --buildtype=release "$(abspath $(DXVK_OBJ32))" + PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" \ + meson --prefix="$(abspath $(DXVK_OBJ32))" --cross-file build-win32.txt "$(abspath $(DXVK_OBJ32))" + + cd "$(DXVK_OBJ32)" && \ + PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" meson configure -Dbuildtype=release ## dxvk goals DXVK_TARGETS = dxvk dxvk_configure dxvk32 dxvk64 dxvk_configure32 dxvk_configure64 @@ -866,31 +864,25 @@ dxvk_configure32: $(DXVK_CONFIGURE_FILES32) dxvk: dxvk32 dxvk64 dxvk64: $(DXVK_CONFIGURE_FILES64) - (cd "$(DXVK_OBJ64)" && \ - PATH="$(abspath $(SRCDIR))/glslang/bin/:$(abspath $(TOOLS_DIR64))/bin/:$(PATH)" ninja && \ - PATH="$(abspath $(SRCDIR))/glslang/bin/:$(abspath $(TOOLS_DIR64))/bin/:$(PATH)" ninja install) && \ - mkdir -p "$(DST_DIR)"/lib64/wine/dxvk "$(DST_DIR)"/lib64/wine/wined3d && \ - cp -a "$(DXVK_OBJ64)"/lib/*.dll.so "$(DST_DIR)"/lib64/wine/dxvk && \ - ( cd $(SRCDIR) && git submodule status -- dxvk ) > "$(DST_DIR)"/lib64/wine/dxvk/version && \ - for f in "$(DST_DIR)"/lib64/wine/dxvk/*.dll.so; do \ - if [ -e "$(DST_DIR)"/lib64/wine/$$(basename $$f) ]; then \ - mv "$(DST_DIR)"/lib64/wine/$$(basename $$f) "$(DST_DIR)"/lib64/wine/wined3d/; \ - fi; \ - done + cd "$(DXVK_OBJ64)" && \ + PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" ninja && \ + PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" ninja install + + mkdir -p "$(DST_DIR)/lib64/wine/dxvk" + cp "$(DXVK_OBJ64)"/bin/dxgi.dll "$(DST_DIR)"/lib64/wine/dxvk + cp "$(DXVK_OBJ64)"/bin/d3d11.dll "$(DST_DIR)"/lib64/wine/dxvk + ( cd $(SRCDIR) && git submodule status -- dxvk ) > "$(DST_DIR)"/lib64/wine/dxvk/version dxvk32: $(DXVK_CONFIGURE_FILES32) - (cd "$(DXVK_OBJ32)" && \ - PATH="$(abspath $(SRCDIR))/glslang/bin/:$(abspath $(TOOLS_DIR32)/bin/):$(PATH)" ninja && \ - PATH="$(abspath $(SRCDIR))/glslang/bin/:$(abspath $(TOOLS_DIR32)/bin/):$(PATH)" ninja install) && \ - mkdir -p "$(DST_DIR)"/lib/wine/dxvk "$(DST_DIR)"/lib/wine/wined3d && \ - cp -a "$(DXVK_OBJ32)"/lib/*.dll.so "$(DST_DIR)"/lib/wine/dxvk && \ - ( cd $(SRCDIR) && git submodule status -- dxvk ) > "$(DST_DIR)"/lib/wine/dxvk/version && \ - for f in "$(DST_DIR)"/lib/wine/dxvk/*.dll.so; do \ - if [ -e "$(DST_DIR)"/lib/wine/$$(basename $$f) ]; then \ - mv "$(DST_DIR)"/lib/wine/$$(basename $$f) "$(DST_DIR)"/lib/wine/wined3d/; \ - fi; \ - done + cd "$(DXVK_OBJ32)" && \ + PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" ninja && \ + PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" ninja install + + mkdir -p "$(DST_DIR)"/lib/wine/dxvk + cp "$(DXVK_OBJ32)"/bin/dxgi.dll "$(DST_DIR)"/lib/wine/dxvk/ + cp "$(DXVK_OBJ32)"/bin/d3d11.dll "$(DST_DIR)"/lib/wine/dxvk/ + ( cd $(SRCDIR) && git submodule status -- dxvk ) > "$(DST_DIR)"/lib/wine/dxvk/version endif # NO_DXVK diff --git a/proton b/proton index 2951d3fc..243e075b 100755 --- a/proton +++ b/proton @@ -82,31 +82,6 @@ def upgrade_pfx(old_ver): shutil.rmtree(prefix) return - if old_proton_ver == "3.7": - #proton 3.7 used symlinks to install DXVK. this is no longer needed, - #restore to correct wine configuration - log("Fixing up d3d11 symlinks") - - #64-bit - link_dir = prefix + "drive_c/windows/system32" - dll_dir = basedir + "/dist/lib64/wine/fakedlls" - if os.path.lexists(link_dir + "/d3d11.dll"): - os.remove(link_dir + "/d3d11.dll") - if os.path.lexists(link_dir + "/dxgi.dll"): - os.remove(link_dir + "/dxgi.dll") - shutil.copy(dll_dir + "/d3d11.dll", link_dir + "/d3d11.dll") - shutil.copy(dll_dir + "/dxgi.dll", link_dir + "/dxgi.dll") - - #32-bit - link_dir = prefix + "drive_c/windows/syswow64" - dll_dir = basedir + "/dist/lib/wine/fakedlls" - if os.path.lexists(link_dir + "/d3d11.dll"): - os.remove(link_dir + "/d3d11.dll") - if os.path.lexists(link_dir + "/dxgi.dll"): - os.remove(link_dir + "/dxgi.dll") - shutil.copy(dll_dir + "/d3d11.dll", link_dir + "/d3d11.dll") - shutil.copy(dll_dir + "/dxgi.dll", link_dir + "/dxgi.dll") - def run_wine(args): subprocess.call(args, env=env, stderr=lfile) @@ -231,11 +206,6 @@ check_environment("PROTON_NO_ESYNC", "noesync") if not "noesync" in config_opts: env["WINEESYNC"] = "1" -if "wined3d11" in config_opts: - env["WINEDLLPATH"] = lib64dir + "/wine/wined3d:" + libdir + "/wine/wined3d:" + env["WINEDLLPATH"] -else: - env["WINEDLLPATH"] = lib64dir + "/wine/dxvk:" + libdir + "/wine/dxvk:" + env["WINEDLLPATH"] - lfile = None if "SteamGameId" in env: if env["WINEDEBUG"] != "-all": @@ -288,6 +258,9 @@ with prefix_lock: shutil.copy(basedir + "/dist/lib/wine/fakedlls/vrclient.dll", dst) shutil.copy(basedir + "/dist/lib64/wine/fakedlls/vrclient_x64.dll", dst) + shutil.copy(basedir + "/dist/lib/wine/dxvk/openvr_api_dxvk.dll", prefix + "/drive_c/windows/syswow64/") + shutil.copy(basedir + "/dist/lib64/wine/dxvk/openvr_api_dxvk.dll", prefix + "/drive_c/windows/system32/") + #parse linux openvr config and present it in win32 format to the app. #logic from openvr's CVRPathRegistry_Public::GetPaths @@ -362,6 +335,29 @@ with prefix_lock: except (ValueError, OSError): log("Unable to write VR config! " + str(sys.exc_info()[1])) + def make_dxvk_links(dll_dir, link_dir): + if os.path.lexists(link_dir + "/d3d11.dll"): + os.remove(link_dir + "/d3d11.dll") + if os.path.lexists(link_dir + "/dxgi.dll"): + os.remove(link_dir + "/dxgi.dll") + os.symlink(dll_dir + "/d3d11.dll", link_dir + "/d3d11.dll") + os.symlink(dll_dir + "/dxgi.dll", link_dir + "/dxgi.dll") + + 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" + if "nod3d11" in config_opts: dlloverrides["d3d11"] = "" if "dxgi" in dlloverrides: diff --git a/vrclient_x64/vrclient_x64/vrclient_main.c b/vrclient_x64/vrclient_x64/vrclient_main.c index dc46e7cf..0fc03b09 100644 --- a/vrclient_x64/vrclient_x64/vrclient_main.c +++ b/vrclient_x64/vrclient_x64/vrclient_main.c @@ -650,6 +650,10 @@ static EVRCompositorError ivrcompositor_submit_dxvk( load_vk_unwrappers(); vkdata.m_nImage = (uint64_t)image_handle; + vkdata.m_pDevice = get_native_VkDevice(vkdata.m_pDevice); + vkdata.m_pPhysicalDevice = get_native_VkPhysicalDevice(vkdata.m_pPhysicalDevice); + vkdata.m_pInstance = get_native_VkInstance(vkdata.m_pInstance); + vkdata.m_pQueue = get_native_VkQueue(vkdata.m_pQueue); vkdata.m_nWidth = image_info.extent.width; vkdata.m_nHeight = image_info.extent.height; vkdata.m_nFormat = image_info.format;