summary refs log tree commit diff
path: root/pkgs/misc/dxvk
diff options
context:
space:
mode:
authorRandy Eckenrode <randy@largeandhighquality.com>2022-03-09 11:31:10 -0500
committerRandy Eckenrode <randy@largeandhighquality.com>2022-03-09 11:31:10 -0500
commitf29e152b7e23c163b904a942af33875d87effc12 (patch)
treed1d5c4bb643c095f015124517a8c13a918b71631 /pkgs/misc/dxvk
parente2369cb9c90b92a465aeb40d62f2abd467c91543 (diff)
downloadnixpkgs-f29e152b7e23c163b904a942af33875d87effc12.tar
nixpkgs-f29e152b7e23c163b904a942af33875d87effc12.tar.gz
nixpkgs-f29e152b7e23c163b904a942af33875d87effc12.tar.bz2
nixpkgs-f29e152b7e23c163b904a942af33875d87effc12.tar.lz
nixpkgs-f29e152b7e23c163b904a942af33875d87effc12.tar.xz
nixpkgs-f29e152b7e23c163b904a942af33875d87effc12.tar.zst
nixpkgs-f29e152b7e23c163b904a942af33875d87effc12.zip
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.
Diffstat (limited to 'pkgs/misc/dxvk')
-rw-r--r--pkgs/misc/dxvk/darwin-moltenvk-compat.patch59
-rw-r--r--pkgs/misc/dxvk/default.nix8
2 files changed, 5 insertions, 62 deletions
diff --git a/pkgs/misc/dxvk/darwin-moltenvk-compat.patch b/pkgs/misc/dxvk/darwin-moltenvk-compat.patch
deleted file mode 100644
index 7d16fdf7033..00000000000
--- a/pkgs/misc/dxvk/darwin-moltenvk-compat.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-Source: https://github.com/Gcenx/MoltenVK/commit/1f268bd45f6c928784d7cb90dedce382895f10ae
-
-Fake extensions for DXVK;
-- _features.geometryShader
-- _features.tessellationShader
-- _features.shaderCullDistance
-
-Enabled defaults;
-- MVK_ALLOW_METAL_FENCES=1
-- MVK_CONFIG_RESUME_LOST_DEVICE=1
----
- MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm  | 3 +++
- MoltenVK/MoltenVK/Utility/MVKEnvironment.h | 4 ++--
- 2 files changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
-index bc6d19df..e1959c6e 100644
---- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
-+++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
-@@ -1656,6 +1656,8 @@
-     _features.robustBufferAccess = true;  // XXX Required by Vulkan spec
-     _features.fullDrawIndexUint32 = true;
-     _features.independentBlend = true;
-+    _features.geometryShader = true;  // XXX Required by DXVK for D3D10
-+    _features.tessellationShader = true;  // XXX Required by DXVK for D3D11
-     _features.sampleRateShading = true;
-     _features.depthBiasClamp = true;
-     _features.fillModeNonSolid = true;
-@@ -1669,6 +1671,7 @@
-     _features.shaderUniformBufferArrayDynamicIndexing = true;
-     _features.shaderStorageBufferArrayDynamicIndexing = true;
-     _features.shaderClipDistance = true;
-+    _features.shaderCullDistance = true;  // XXX Required by DXVK for 10level9
-     _features.shaderInt16 = true;
-     _features.multiDrawIndirect = true;
-     _features.inheritedQueries = true;
-diff --git a/MoltenVK/MoltenVK/Utility/MVKEnvironment.h b/MoltenVK/MoltenVK/Utility/MVKEnvironment.h
-index 81d0defc..80c414d3 100644
---- a/MoltenVK/MoltenVK/Utility/MVKEnvironment.h
-+++ b/MoltenVK/MoltenVK/Utility/MVKEnvironment.h
-@@ -240,7 +240,7 @@ void mvkSetConfig(const MVKConfiguration& mvkConfig);
- #   define MVK_ALLOW_METAL_EVENTS    1
- #endif
- #ifndef MVK_ALLOW_METAL_FENCES
--#   define MVK_ALLOW_METAL_FENCES    0
-+#   define MVK_ALLOW_METAL_FENCES    1 // XXX Required by DXVK for Apple/NVidia GPUs (better FPS than CPU Emulation)
- #endif
- 
- /** Substitute Metal 2D textures for Vulkan 1D images. Enabled by default. */
-@@ -275,7 +275,7 @@ void mvkSetConfig(const MVKConfiguration& mvkConfig);
- 
- /** Resume MVKDevice VK_ERROR_DEVICE_LOST errors that do not cause MVKPhysicalDevice errors. Disabled by default. */
- #ifndef MVK_CONFIG_RESUME_LOST_DEVICE
--#   define MVK_CONFIG_RESUME_LOST_DEVICE    0
-+#   define MVK_CONFIG_RESUME_LOST_DEVICE    1
- #endif
- 
- /** Support Metal argument buffers. Disabled by default. */
- 
\ No newline at end of file
diff --git a/pkgs/misc/dxvk/default.nix b/pkgs/misc/dxvk/default.nix
index d1ea829798a..79f4b1af83c 100644
--- a/pkgs/misc/dxvk/default.nix
+++ b/pkgs/misc/dxvk/default.nix
@@ -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 MoltenVK’s 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
         ];
       });