Engine: native presets K and M in the D3D12 shim, wider game coverage

A standalone Vulkan inference engine (engine/) for DLSS presets K and M that
runs from weights extracted from the user's own nvngx_dlss.dll, with d4r's
own input, network and reconstruction shaders or the native HIP network
layers, recorded into the game's command list by the shim. Opt-in
([Engine] Enabled / D4R_ENGINE=1); anything uncovered falls back to the
CUDA/ZLUDA path with the reason logged.

Byte-identical to NGX's CUDA backend under the phase-capable reference
(1706x960 -> 2560x1440, native HIP network, eleven frames, RX 9070 XT):
- K render- and display-resolution motion vectors, HDR and LDR
- K game-supplied exposure and automatic exposure with any pre-exposure
  and exposure scale (one residual: effective exposure exactly 2 or 4)
- K and M with the DLSS indicator's inverted-axis parameters
- M with any exposure settings (NGX ignores them for M)
K packages need the current compile_k.py (marker D4RO0003).

Also: HIP shared buffers are pooled across feature recreation (ROCm leaks
destroyed imports), hipnet.bin must match the preset, M-only games do not
load the K model, install_d4r_runtime.sh stages k, k-ldr, m, m-ldr with
hip/, the activation table has a generator (gen_activation_m.py), and
package_release.sh can bundle the engine's shaders (never its weights).

Signed-off-by: woutermans <[email protected]>
This commit is contained in:
woutermans committed 2026-10-10 20:54:01 +02:00
1 parent 16cfc1f063
commit e0d1549a21
82 files changed
+13335 -96

No files matched your search

+11 -1
View File
@@ -86,6 +86,15 @@ Settings
PreferAccuracy = true. This uses original translated enc1/enc2 layers while retaining other
native acceleration. It reduced trails in a captured Townfall sequence on RX 7700 XT and costs
some GPU time. Restart after changing it; other scenes and RDNA4 hardware still need testing.
- [Engine] Enabled = true (experimental, off by default) runs DLSS 4 (K) and 4.5 (M) on d4r's own Vulkan
inference engine: the upscale is recorded into the game's own frame instead of going through CUDA
emulation. It needs Mesa RADV with VK_KHR_cooperative_matrix and the models in d4r/engine/k (K),
d4r/engine/k-ldr (K in games without HDR), d4r/engine/m and d4r/engine/m-ldr (M). Games and settings
it does not cover (other models, display-resolution motion vectors with M) keep using the normal path,
and d4r/d4r_nvngx.log says which one ran and why. Tested in one game so far.
This zip has only the engine's shaders in d4r/engine/k. The weights (weights.bin, offsets.bin,
lut.bin) are read from your own nvngx_dlss.dll with the tools in d4r's source repository
(engine/README.md); until they are there, d4r uses the normal path.
- OptiScaler.ini: OptiScaler's settings, such as its fps overlay and the render resolution of each
quality mode. Press Insert in game for OptiScaler's menu.
[Libraries] NvngxPath=d4r\nvngx.dll explicitly selects d4r's shim; OptiDllPath=d4r is also
@@ -152,7 +161,8 @@ Licenses
d4r is GNU General Public License, version 3 only (GPL-3.0-only). The release also contains ZLUDA (Apache 2.0 or MIT), vkd3d-proton
(LGPL 2.1, patched) and OptiScaler 0.9.4 (GPL 3.0, unmodified). d4r/source/SOURCES.txt says where
each file comes from, and d4r/licenses has the license texts. d4r is not affiliated with NVIDIA,
AMD or the OptiScaler project.
AMD or the OptiScaler project, and is provided "as is", without warranty of any kind (GPL-3.0,
sections 15 and 16).
@clean NVIDIA's files are yours to supply, under NVIDIA's terms.
@full NVIDIA's files in this zip (d4r/nvngx_dlss.dll, d4r/ngx/_nvngx.dll) and the kernels built from
@full NVIDIA's code (listed in d4r/source/SOURCES.txt) are NVIDIA's property, are not covered by