1 | # DXVK Native
|
---|
2 |
|
---|
3 | DXVK Native is a port of [DXVK](https://github.com/doitsujin/dxvk) to Linux which allows it to be used natively without Wine.
|
---|
4 |
|
---|
5 | This is primarily useful for game and application ports to either avoid having to write another rendering backend, or to help with port bringup during development.
|
---|
6 |
|
---|
7 | [Release builds](https://github.com/Joshua-Ashton/dxvk-native/releases) are built using the Steam Runtime.
|
---|
8 |
|
---|
9 | ### How does it work?
|
---|
10 |
|
---|
11 | DXVK Native replaces certain Windows-isms with a platform and framework-agnostic replacement, for example, `HWND`s can become `SDL_Window*`s, etc.
|
---|
12 | All it takes to do that is to add another WSI backend.
|
---|
13 |
|
---|
14 | DXVK Native comes with a slim set of Windows header definitions required for D3D9/11 and the MinGW headers for D3D9/11.
|
---|
15 | In most cases, it will end up being plug and play with your renderer, but there may be certain teething issues such as:
|
---|
16 | - `__uuidof(type)` is supported, but `__uuidof(variable)` is not supported. Use `__uuidof_var(variable)` instead.
|
---|
17 |
|
---|
18 | DXVK Native also has some performance tweaks for D3D9, disabling float emulation and some validation.
|
---|
19 | This is configurable in `d3d9_config.h`.
|
---|
20 |
|
---|
21 | ## Games/Projects Using DXVK Native
|
---|
22 |
|
---|
23 | - [Portal 2](https://store.steampowered.com/app/620/Portal_2/) (Valve - Windows & Linux)
|
---|
24 | - [Left 4 Dead 2](https://store.steampowered.com/app/550/Left_4_Dead_2/) (Valve - Windows & Linux)
|
---|
25 | - [Ys VIII, Ys IX](https://stadia.google.com/games) (PH3 Games - Stadia)
|
---|
26 | - [Perimeter](https://github.com/KranX/Perimeter) (Linux)
|
---|
27 | - [Momentum Mod](https://momentum-mod.org/) (Linux)
|
---|
28 | - [Portal 2: Community Edition](https://store.steampowered.com/app/440000/Portal_2_Community_Edition/) (Linux)
|
---|
29 |
|
---|
30 | ## Build instructions
|
---|
31 |
|
---|
32 | ### Requirements:
|
---|
33 | - A C++17 compiler (eg. GCC, Clang, MSVC)
|
---|
34 | - [Meson](https://mesonbuild.com/) build system (at least version 0.46)
|
---|
35 | - [glslang](https://github.com/KhronosGroup/glslang) compiler
|
---|
36 |
|
---|
37 |
|
---|
38 | ### Steam Runtime
|
---|
39 |
|
---|
40 | DXVK Native can be built in the Steam Runtime using `docker`.
|
---|
41 | If you don't care about this, simply skip this section.
|
---|
42 |
|
---|
43 | To build in a Steam Runtime docker, simply `cd` to the DXVK directory and run:
|
---|
44 |
|
---|
45 | for 32-bit:
|
---|
46 | `docker run -e USER=$USER -e USERID=$UID -it --rm -v $(pwd):/dxvk-native registry.gitlab.steamos.cloud/steamrt/scout/sdk/i386 /bin/bash`
|
---|
47 |
|
---|
48 | for 64-bit:
|
---|
49 | `docker run -e USER=$USER -e USERID=$UID -it --rm -v $(pwd):/dxvk-native registry.gitlab.steamos.cloud/steamrt/scout/sdk /bin/bash`
|
---|
50 |
|
---|
51 | ### Building the library
|
---|
52 |
|
---|
53 | Inside the DXVK directory, run either:
|
---|
54 |
|
---|
55 | On your host machine:
|
---|
56 | ```
|
---|
57 | ./package-native.sh master /your/target/directory --no-package
|
---|
58 | ```
|
---|
59 |
|
---|
60 | With Steam Runtime:
|
---|
61 | ```
|
---|
62 | ./package-native-steamrt.sh master /your/target/directory --no-package
|
---|
63 | ```
|
---|
64 |
|
---|
65 | This will create a folder dxvk-native-master in /your/target/directory which will contain a the libraries and tests.
|
---|
66 |
|
---|
67 | In order to preserve the build directories and symbols for development, pass `--dev-build` to the script.
|
---|
68 |
|
---|
69 | ### HUD
|
---|
70 | The `DXVK_HUD` environment variable controls a HUD which can display the framerate and some stat counters. It accepts a comma-separated list of the following options:
|
---|
71 | - `devinfo`: Displays the name of the GPU and the driver version.
|
---|
72 | - `fps`: Shows the current frame rate.
|
---|
73 | - `frametimes`: Shows a frame time graph.
|
---|
74 | - `submissions`: Shows the number of command buffers submitted per frame.
|
---|
75 | - `drawcalls`: Shows the number of draw calls and render passes per frame.
|
---|
76 | - `pipelines`: Shows the total number of graphics and compute pipelines.
|
---|
77 | - `memory`: Shows the amount of device memory allocated and used.
|
---|
78 | - `gpuload`: Shows estimated GPU load. May be inaccurate.
|
---|
79 | - `version`: Shows DXVK version.
|
---|
80 | - `api`: Shows the D3D feature level used by the application.
|
---|
81 | - `compiler`: Shows shader compiler activity
|
---|
82 | - `samplers`: Shows the current number of sampler pairs used *[D3D9 Only]*
|
---|
83 | - `scale=x`: Scales the HUD by a factor of `x` (e.g. `1.5`)
|
---|
84 |
|
---|
85 | Additionally, `DXVK_HUD=1` has the same effect as `DXVK_HUD=devinfo,fps`, and `DXVK_HUD=full` enables all available HUD elements.
|
---|
86 |
|
---|
87 | ### Frame rate limit
|
---|
88 | The `DXVK_FRAME_RATE` environment variable can be used to limit the frame rate. A value of `0` uncaps the frame rate, while any positive value will limit rendering to the given number of frames per second. Alternatively, the configuration file can be used.
|
---|
89 |
|
---|
90 | ### Device filter
|
---|
91 | Some applications do not provide a method to select a different GPU. In that case, DXVK can be forced to use a given device:
|
---|
92 | - `DXVK_FILTER_DEVICE_NAME="Device Name"` Selects devices with a matching Vulkan device name, which can be retrieved with tools such as `vulkaninfo`. Matches on substrings, so "VEGA" or "AMD RADV VEGA10" is supported if the full device name is "AMD RADV VEGA10 (LLVM 9.0.0)", for example. If the substring matches more than one device, the first device matched will be used.
|
---|
93 |
|
---|
94 | **Note:** If the device filter is configured incorrectly, it may filter out all devices and applications will be unable to create a D3D device.
|
---|
95 |
|
---|
96 | ### State cache
|
---|
97 | DXVK caches pipeline state by default, so that shaders can be recompiled ahead of time on subsequent runs of an application, even if the driver's own shader cache got invalidated in the meantime. This cache is enabled by default, and generally reduces stuttering.
|
---|
98 |
|
---|
99 | The following environment variables can be used to control the cache:
|
---|
100 | - `DXVK_STATE_CACHE=0` Disables the state cache.
|
---|
101 | - `DXVK_STATE_CACHE_PATH=/some/directory` Specifies a directory where to put the cache files. Defaults to the current working directory of the application.
|
---|
102 |
|
---|
103 | ### Debugging
|
---|
104 | The following environment variables can be used for **debugging** purposes.
|
---|
105 | - `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` Enables Vulkan debug layers. Highly recommended for troubleshooting rendering issues and driver crashes. Requires the Vulkan SDK to be installed on the host system.
|
---|
106 | - `DXVK_LOG_LEVEL=none|error|warn|info|debug` Controls message logging.
|
---|
107 | - `DXVK_LOG_PATH=/some/directory` Changes path where log files are stored. Set to `none` to disable log file creation entirely, without disabling logging.
|
---|
108 | - `DXVK_CONFIG_FILE=/xxx/dxvk.conf` Sets path to the configuration file.
|
---|
109 | - `DXVK_PERF_EVENTS=1` Enables use of the VK_EXT_debug_utils extension for translating performance event markers.
|
---|