about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/dx/dxvk_1/package.nix
blob: 44a39eeaba255c58d6ab731e0a3d6780457d7613 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{ lib
, stdenv
, fetchFromGitHub
, glslang
, meson
, ninja
, windows
, pkgsBuildHost
, enableMoltenVKCompat ? false
}:

let
  isCross = stdenv.hostPlatform != stdenv.targetPlatform;
in
stdenv.mkDerivation (finalAttrs:  {
  pname = "dxvk";
  version = "1.10.3";

  src = fetchFromGitHub {
    owner = "doitsujin";
    repo = "dxvk";
    rev = "v${finalAttrs.version}";
    hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE=";
  };

  # These patches are required when using DXVK with Wine on Darwin.
  patches = lib.optionals enableMoltenVKCompat [
    # Patch DXVK to work with MoltenVK even though it doesn’t support some required features.
    # Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well.
    ./darwin-dxvk-compat.patch
    # Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin.
    # See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/
    ./darwin-thread-primitives.patch
  ];

  nativeBuildInputs = [ glslang meson ninja ];
  buildInputs = [ windows.pthreads ];

  mesonFlags =
    let
      arch = if stdenv.is32bit then "32" else "64";
    in
    [
      "--buildtype" "release"
      "--prefix" "${placeholder "out"}"
    ]
    ++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ];

  meta = {
    description = "A Vulkan-based translation layer for Direct3D 9/10/11";
    homepage = "https://github.com/doitsujin/dxvk";
    changelog = "https://github.com/doitsujin/dxvk/releases";
    maintainers = [ lib.maintainers.reckenrode ];
    license = lib.licenses.zlib;
    platforms = lib.platforms.windows;
  };
})