dxvk: support version-specific MoltenVK patches

While it’s unlikely, it’s possible that different MoltenVK versions
could require their own compatability patches. Support that by making
the `moltenvk` derivation provide the patch via `passthru`. There is no
package with the patch applied because the patch should never be used by
anything other than DXVK.
This commit is contained in:
Randy Eckenrode 2022-03-09 11:31:10 -05:00
parent e2369cb9c9
commit f29e152b7e
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
3 changed files with 9 additions and 3 deletions

View File

@ -72,6 +72,7 @@ let
# DXVK with MoltenVK requires a patched MoltenVK in addition to its own patches. Provide a
# convenience function to handle the necessary patching.
#
# Usage:
# let
# patchedMoltenVK = dxvk.patchMoltenVK darwin.moltenvk;
@ -80,9 +81,10 @@ let
passthru.patchMoltenVK = moltenvk:
moltenvk.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
# Lie to DXVK about certain features that DXVK expects to be available and set defaults
# for better performance/compatability on certain hardware.
./darwin-moltenvk-compat.patch
# Apply MoltenVKs DXVK compatability patch. This is needed to fake support for certain
# extensions. There is no package for a patched MoltenVK to avoid any confusion by users
# whether they should use it. Except with DXVK, the answer is always no.
old.passthru.dxvkPatch
];
});

View File

@ -43,6 +43,10 @@ stdenvNoCC.mkDerivation rec {
# MoltenVK requires specific versions of its dependencies.
# Pin them here except for cereal, which is four years old and has several CVEs.
passthru = {
# The patch required to support DXVK may different from version to version. This should never
# be used except with DXVK, so theres no package for it. To emphasize that this patch should
# never be used except with DXVK, `dxvk` provides a function for applying this patch.
dxvkPatch = ./dxvk-moltenvk-compat.patch;
glslang = (glslang.overrideAttrs (old: {
src = fetchFromGitHub {
owner = "KhronosGroup";