release: install.sh asks what to install, caches the NVIDIA DLLs and the engine models, and [Engine] defaults to auto

Verified copies go to ~/.cache/d4r: the next game's install copies them instead of downloading or building
again. Enabled = auto (the new default) turns the engine on when d4r/engine holds a model; the shim probes the
nine model folders. build-engine-models.sh gains --exact (NVIDIA's roundings) and --find-proton.
This commit is contained in:
woutermans committed 2026-10-14 20:25:06 +02:00
1 parent d1559ca5fa
commit 747ac8538d
5 files changed
+244 -118

No files matched your search

+13 -11
View File
@@ -57,13 +57,14 @@ that archive's d4r/README.txt: setup runs automatically when the ASI loads.
@installer d4r/ngx/_nvngx.dll. No sudo is needed. The driver archive is about 915 MiB; it is extracted,
@installer never executed. Downloads are temporary. Run it again to check the files; differing existing
@installer DLLs are backed up before replacement.
@installer It then builds the native engine's models in d4r/engine from those DLLs ([Engine] under
@installer Settings): Ray Reconstruction D, E and F straight from nvngx_dlssd.dll, and Super Resolution
@installer K, M and L (with their LDR variants) by rendering one test frame per model through d4r under
@installer GE-Proton 11, found in Steam's compatibility tools (or set D4R_PROTON=/path/to/GE-Proton11-3).
@installer The first time this takes a few minutes while DLSS's kernels compile. --no-engine skips it;
@installer bash install.sh --engine-only builds the models later, --rebuild-engine builds them again.
@clean 2. Copy nvngx_dlss.dll into the d4r folder, and _nvngx.dll into d4r/ngx.
@installer Verified copies are kept in ~/.cache/d4r/nvidia, so installing d4r in the next game needs no
@installer download. install.sh then asks whether to set up d4r's own DLSS engine (recommended: faster,
@installer lower latency). That builds the engine's models in d4r/engine from the DLLs: Ray Reconstruction
@installer D, E and F straight from nvngx_dlssd.dll, and Super Resolution K, M and L (with their LDR
@installer variants) by rendering one test frame per model through d4r under GE-Proton 11, found in Steam's
@installer compatibility tools (or set D4R_PROTON=/path/to/GE-Proton11-3). It takes a minute or two once;
@installer the models are kept in ~/.cache/d4r/engine-models for the next game. bash install.sh --help lists
@installer options for scripted installs.
@installer 3. In Steam, open the game's Properties:
@clean 3. In Steam, open the game's Properties:
@full 2. In Steam, open the game's Properties:
@@ -107,9 +108,10 @@ 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), 4.5 (M and L) and Ray
Reconstruction (D, E and F) on d4r's own Vulkan inference engine: the work is recorded into the game's
own frame instead of going through CUDA emulation. It needs Mesa RADV with VK_KHR_cooperative_matrix
- [Engine] runs DLSS 4 (K), 4.5 (M and L) and Ray Reconstruction (D, E and F) on d4r's own Vulkan
inference engine: the work is recorded into the game's own frame instead of going through CUDA
emulation, which is faster. Enabled = auto (the default) uses it whenever its models are in d4r/engine;
true / false force it on / off. It needs Mesa RADV with VK_KHR_cooperative_matrix
and the models in d4r/engine: k (K), k-ldr (K in games without HDR), m and m-ldr (M), l and l-ldr (L),
rr-d, rr-e and rr-f (Ray Reconstruction). Games and settings it does not cover (other models,
display-resolution motion vectors with L or M) keep using the normal path,
@@ -197,7 +199,7 @@ Uninstall
---------
Delete dxgi.dll, OptiScaler.ini, OptiScaler.log (if present), d3d12.dll, d3d12core.dll,
D4R_README.txt, install.sh (if present) and the d4r folder from the game folder, and clear the launch options. The kernel
cache in ~/.cache/d4r can be deleted too.
cache in ~/.cache/d4r can be deleted too; it also holds install.sh's copies of the NVIDIA DLLs and the engine models.
Licenses
+27 -18
View File
@@ -2,7 +2,8 @@
# Builds the native engine's models ([Engine] in d4r.ini) on this machine, from the NVIDIA DLLs install.sh put in
# the d4r folder. Shipped as d4r/tools/build-engine-models.sh; install.sh runs it.
#
# usage: bash d4r/tools/build-engine-models.sh [--rr-only | --sr-only] [D4R_FOLDER]
# usage: bash d4r/tools/build-engine-models.sh [--rr-only | --sr-only] [--exact] [D4R_FOLDER]
# bash d4r/tools/build-engine-models.sh --find-proton prints the GE-Proton it would use (or nothing)
#
# Ray Reconstruction engine/rr-d, rr-e, rr-f from d4r/nvngx_dlssd.dll 310.9.1 alone (about half a minute)
# Super Resolution engine/k, k-ldr, m, m-ldr, l, l-ldr
@@ -11,19 +12,41 @@
# GE-Proton, and the uploads are saved (a minute or two each; the first run also compiles
# DLSS's kernels and creates a temporary Proton prefix)
# Needs python3 with numpy, and for Super Resolution a GE-Proton (D4R_PROTON=/path/to/GE-Proton11-3 to choose one).
# The models are the fastest builds (this GPU's own arithmetic; engine/README.md). --exact builds NVIDIA's roundings
# instead: bit-identical to the CUDA path, about 20% slower (K is the same either way).
# Everything written is derived from NVIDIA's DLLs: it stays in this folder and must not be redistributed.
set -euo pipefail
fail() { printf 'build-engine-models: %s\n' "$*" >&2; exit 1; }
DO_RR=1 DO_SR=1
DO_RR=1 DO_SR=1 FIND_PROTON=0
while [[ $# -gt 0 ]]; do
case "$1" in
--rr-only) DO_SR=0; shift ;;
--sr-only) DO_RR=0; shift ;;
-h|--help) sed -n '2,15p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
--exact) export D4R_RR_RELAXED=0 M_EXACT=1; shift ;;
--find-proton) FIND_PROTON=1; shift ;;
-h|--help) sed -n '2,19p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
*) break ;;
esac
done
find_proton() {
# a GE-Proton: D4R_PROTON, else GE-Proton11-3 (the tested one), else the newest stock GE-Proton11-N in Steam's
# compatibility tools. Renamed or rebuilt variants (2026-10-14: one with a suffix after the version number) can
# fail NGX's CUDA initialisation, so they are only used when named.
PROTON="${D4R_PROTON:-}"
if [[ -z "$PROTON" ]]; then
best=-1
for d in "$HOME/.local/share/Steam" "$HOME/.steam/root" "$HOME/.steam/steam" \
"$HOME/.var/app/com.valvesoftware.Steam/data/Steam"; do
for p in "$d"/compatibilitytools.d/GE-Proton11-*; do
n="${p##*/GE-Proton11-}"
[[ -x "$p/proton" && "$n" =~ ^[0-9]+$ ]] || continue
if [[ "$n" == 3 ]]; then best=1000; PROTON="$p"; elif (( n > best )); then best=$n; PROTON="$p"; fi
done
done
fi
}
if (( FIND_PROTON )); then find_proton; [[ -z "$PROTON" ]] || printf '%s\n' "$PROTON"; exit 0; fi
TOOLS="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
KIT="$TOOLS/models"
RUNTIME="$(cd -- "${1:-$TOOLS/..}" && pwd)"
@@ -82,21 +105,7 @@ if (( DO_SR )); then
DLL="$RUNTIME/nvngx_dlss.dll"
[[ -f "$DLL" && "$(sha "$DLL")" == "$DLSS_SHA256" ]] || fail "Super Resolution models need nvngx_dlss.dll 310.7.0 in $RUNTIME (run install.sh)"
[[ -f "$RUNTIME/ngx/_nvngx.dll" ]] || fail "missing $RUNTIME/ngx/_nvngx.dll (run install.sh)"
# a GE-Proton: D4R_PROTON, else GE-Proton11-3 (the tested one), else the newest stock GE-Proton11-N in Steam's
# compatibility tools. Renamed or rebuilt variants (2026-10-14: one with a suffix after the version number) can
# fail NGX's CUDA initialisation, so they are only used when named.
PROTON="${D4R_PROTON:-}"
if [[ -z "$PROTON" ]]; then
best=-1
for d in "$HOME/.local/share/Steam" "$HOME/.steam/root" "$HOME/.steam/steam" \
"$HOME/.var/app/com.valvesoftware.Steam/data/Steam"; do
for p in "$d"/compatibilitytools.d/GE-Proton11-*; do
n="${p##*/GE-Proton11-}"
[[ -x "$p/proton" && "$n" =~ ^[0-9]+$ ]] || continue
if [[ "$n" == 3 ]]; then best=1000; PROTON="$p"; elif (( n > best )); then best=$n; PROTON="$p"; fi
done
done
fi
find_proton
[[ -n "$PROTON" && -x "$PROTON/proton" ]] ||
fail 'no GE-Proton found: set D4R_PROTON=/path/to/GE-Proton11-3 (the folder holding the proton script)'
STEAM_ROOT="$(dirname -- "$(dirname -- "$PROTON")")"
+8 -6
View File
@@ -29,7 +29,7 @@ ShowWatermark = false
Enable = auto
; Independent denoiser presets: auto (game choice), default, D, E (transformer) or F (DLSS 4.5).
; E and F through NVIDIA's library need a denoiser DLL containing that model (F: 310.9 or later). On the engine
; ([Engine] Enabled = true) F runs from the model in d4r\engine\rr-f; frames the library serves instead show
; ([Engine]) F runs from the model in d4r\engine\rr-f; frames the library serves instead show
; preset D when the DLL is older (d4r_nvngx.log says so).
Model = auto
@@ -73,11 +73,13 @@ ElideNgxSync = true
DirectOutput = auto
[Engine]
; Experimental. Runs DLSS 4 and 4.5 (models K, L and M) on d4r's own Vulkan inference engine instead of NVIDIA's
; kernels: the game shows the result of the frame it just rendered and [Latency] / [Interop] do not apply.
; Needs Mesa RADV with VK_KHR_cooperative_matrix and the models in d4r\engine\k, k-ldr, m, m-ldr, l and l-ldr
; (see D4R_README.txt). Games or settings it does not cover use the normal path; d4r_nvngx.log says why.
Enabled = false
; Runs DLSS 4 and 4.5 (models K, L and M) and Ray Reconstruction (D, E and F) on d4r's own Vulkan inference
; engine instead of NVIDIA's kernels: the faster path, and the game shows the result of the frame it just rendered
; ([Latency] / [Interop] do not apply). Needs Mesa RADV with VK_KHR_cooperative_matrix and the models install.sh
; builds in d4r\engine (k, k-ldr, m, m-ldr, l, l-ldr, rr-d, rr-e, rr-f). Games or settings it does not cover,
; and a device that cannot run it, use the normal path; d4r_nvngx.log says why.
; auto = on when d4r\engine holds a model, true / false = always / never.
Enabled = auto
; Another model K folder for games with the HDR flag (a path relative to the d4r folder, or a Windows path
; such as Z:\home\me\k)
ModelDir = auto