From 780f0f5bb7acab5cd15eef1510a6efc04ec6804c Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 24 Jul 2021 16:46:34 +0200 Subject: [PATCH] Add switch for dxvk-async. --- default.nix | 12 +++++++++--- dxvk.nix | 12 +++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 4621b8b..7c6c1d3 100644 --- a/default.nix +++ b/default.nix @@ -4,6 +4,8 @@ prefixBaseDir ? "$HOME/.winenix", binName ? "starcitizen", launcherArgs ? [ "--use-gl=osmesa" ], + dxvkPatches ? [ ], + dxvkAsync ? false, winePackage ? pkgs.wineWowPackages.unstable, wineGlobalEnv ? [ "DXVK_STATE_CACHE=0" ], winePatches ? [ ./patches/joyaxis.patch ], @@ -21,9 +23,11 @@ assert !(builtins.any (lib.strings.hasSuffix "/") [ installDir launcherCache pre let winePkg = winePackage.overrideAttrs (attrs: { patches = attrs.patches ++ winePatches; -}); + }); + dxvk = (pkgsCross.mingwW64.callPackage ./dxvk.nix { async = dxvkAsync; }).overrideAttrs + ( attrs: { patches = attrs.patches ++ dxvkPatches; }); + dxvkAsyncEnv = "DXVK_ASYNC=1" ; - dxvk = (with import ~/repositories/nixpkgs/default.nix {}; pkgsCross.mingwW64.callPackage ./dxvk.nix { }); fonts = pkgs.callPackage ./fonts.nix {}; wine64 = "${winePkg}/bin/wine64"; wineMulti = "${winePkg}/bin/wine"; @@ -149,7 +153,9 @@ let export WINEPREFIX="${prefixBaseDir}/$uuid" #export all global env vars - ${lib.concatMapStrings (x: "export " + x + "\n") wineGlobalEnv } + ${lib.concatMapStrings (x: "export " + x + "\n") (wineGlobalEnv + ++ lib.lists.optional dxvkAsync dxvkAsyncEnv + )} #parse input case "$@" in diff --git a/dxvk.nix b/dxvk.nix index 077d384..0468cfc 100644 --- a/dxvk.nix +++ b/dxvk.nix @@ -1,15 +1,25 @@ -{ stdenv, lib, fetchFromGitHub, glslang, buildPackages, writeScriptBin, pkgs, pkgsCross }: +{ stdenv, lib, fetchFromGitHub, fetchpatch, glslang, buildPackages, writeScriptBin, pkgs, pkgsCross, + async ? false +}: let fix = writeScriptBin "x86_64-w64-mingw32-windres" '' #!${stdenv.shell} exec ${pkgsCross.mingwW64.buildPackages.binutils.bintools}/bin/x86_64-w64-mingw32-windres --preprocessor=x86_64-w64-mingw32-gcc --preprocessor-arg=-E --preprocessor-arg=-xc --preprocessor-arg=-DRC_INVOKED $@ ''; + asyncPatch = (fetchpatch { + name = "dxvk-async"; + url = "https://raw.githubusercontent.com/Sporif/dxvk-async/8911d6da0f838efc8fbbea805da522be4e1ad6c3/dxvk-async.patch"; + sha256 = "0mr43flzim25lfq73pac94ah07yrr86n82fzsx47lxlcmsh9zhrq"; + }); in stdenv.mkDerivation rec { pname = "dxvk"; version = "1.9"; + patches = [] + ++ lib.lists.optional async asyncPatch; + src = fetchFromGitHub { owner = "doitsujin"; repo = "dxvk";