Add CUDA NGX Ray Reconstruction support

Run the signed CUDA-capable denoiser through feature 13 with independent D/E presets, pre-Init discovery, per-frame guide and camera snapshots, normalized integer guide staging, paired alpha output, and recorded-resource retirement.

Add the required ZLUDA/LLVM patch, behavioral configuration tests, GPU harness coverage, optional denoiser installation and packaging, and tested support limitations. Preserve upstream attribution and distinguish LLVM licensing from the ZLUDA portions of the patch.
This commit is contained in:
woutermans committed 2026-10-12 12:47:53 +02:00
1 parent 503061d568
commit 7117c38674
20 files changed
+3038 -114

No files matched your search

+1
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Modified in this fork for CUDA Ray Reconstruction support and validation (2026).
# Run inside packaging/build/Dockerfile.glibc241 with a recent official Rust toolchain and ROCm mounted.
# Supply isolated, patched ZLUDA/vkd3d checkouts and the usual package_release.sh inputs.
set -euo pipefail
+15
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# Modified in this fork for CUDA Ray Reconstruction support and validation (2026).
"""Translate d4r.ini (see config/d4r.ini.default) into shell exports for the game launcher.
usage: d4r_config.py [--config PATH] [--print | --launch]
@@ -86,6 +87,20 @@ def main(argv):
else:
fail(f"[DLSS] Model {model!r}: use one of {', '.join(list(PRESETS) + list(MODEL_ALIASES))} or a preset number")
rr_enabled = flag("RayReconstruction", "Enable")
if rr_enabled is not None:
env["D4R_RR_ENABLE"] = "1" if rr_enabled else "0"
rr_model = get("RayReconstruction", "Model")
if rr_model is not None:
rr_presets = {"DEFAULT": 0, "D": 4, "E": 5}
rr_model = rr_model.upper()
if rr_model in rr_presets:
env["D4R_RR_PRESET"] = str(rr_presets[rr_model])
elif rr_model in ("0", "4", "5"):
env["D4R_RR_PRESET"] = rr_model
else:
fail(f"[RayReconstruction] Model {rr_model!r}: use auto, default, D or E")
age = get("Latency", "FrameAge")
if age is not None:
if age not in ("0", "1", "2", "3"):
+10 -3
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Modified in this fork for CUDA Ray Reconstruction support and validation (2026).
set -euo pipefail
# Stages the pieces a Proton game needs under D4R_RUNTIME_DIR
@@ -7,6 +8,7 @@ set -euo pipefail
# bin/d4r_nvngx.dll D3D12-to-CUDA NGX core shim (OptiScaler NvngxPath target)
# ngx/_nvngx.dll official NGX core
# dlss/nvngx_dlss.dll official DLSS SR feature DLL (also copied into bin/)
# dlss/nvngx_dlssd.dll optional DLSS Ray Reconstruction feature DLL (also in bin/)
# engine/k/, k-ldr/ models of preset K for the native engine ([Engine] in d4r.ini), when D4R_ENGINE_MODEL /
# D4R_ENGINE_MODEL_LDR name the folders engine/compile_k.py wrote (--ldr for the second)
# engine/m/, m-ldr/ models of preset M, when D4R_ENGINE_MODEL_M / D4R_ENGINE_MODEL_M_LDR name the folders
@@ -14,9 +16,9 @@ set -euo pipefail
# engine/l/, l-ldr/ models of preset L, when D4R_ENGINE_MODEL_L / D4R_ENGINE_MODEL_L_LDR name the folders
# engine/compile_m.py wrote from a capture of preset L
# Each model folder is copied whole, with the native HIP network's hipnet.bin and hip/ when built with --hip.
# usage: install_d4r_runtime.sh PATH_TO_NGX_CORE_DLL PATH_TO_NVNGX_DLSS_DLL
if [[ $# -ne 2 ]]; then
printf 'usage: %s PATH_TO_NGX_CORE_DLL PATH_TO_NVNGX_DLSS_DLL\n' "$0" >&2
# usage: install_d4r_runtime.sh PATH_TO_NGX_CORE_DLL PATH_TO_NVNGX_DLSS_DLL [PATH_TO_NVNGX_DLSSD_DLL]
if [[ $# -lt 2 || $# -gt 3 ]]; then
printf 'usage: %s PATH_TO_NGX_CORE_DLL PATH_TO_NVNGX_DLSS_DLL [PATH_TO_NVNGX_DLSSD_DLL]\n' "$0" >&2
exit 2
fi
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -51,5 +53,10 @@ for variant in k k-ldr m m-ldr l l-ldr; do
cp -r "$source_dir" "$RUNTIME/engine/$variant"
printf 'Installed the native engine model in %s\n' "$RUNTIME/engine/$variant"
done
if [[ $# == 3 ]]; then
copy_unless_same "$3" "$RUNTIME/dlss/nvngx_dlssd.dll"
copy_unless_same "$3" "$RUNTIME/bin/nvngx_dlssd.dll"
sha256sum "$RUNTIME/dlss/nvngx_dlssd.dll"
fi
sha256sum "$RUNTIME"/ngx/_nvngx.dll "$RUNTIME"/dlss/nvngx_dlss.dll
printf 'Installed d4r runtime in %s\n' "$RUNTIME"
+3
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Modified in this fork for CUDA Ray Reconstruction support and validation (2026).
# Builds the drag-in release: a zip whose contents are extracted into the folder that holds a game's
# main .exe, like an OptiScaler release. packaging/D4R_README.txt describes the result.
#
@@ -26,6 +27,7 @@
# those is up to whoever publishes it (they are not covered by d4r's license):
# D4R_BUNDLE_DLSS local nvngx_dlss.dll for texture builds (pinned by install.sh in installer mode)
# D4R_BUNDLE_NGX local _nvngx.dll (only required for D4R_BUNDLE_NVIDIA=1)
# D4R_BUNDLE_DLSSD optional nvngx_dlssd.dll to include for Ray Reconstruction (full variant only)
# D4R_BUNDLE_TEX directory with texture-kernel code objects (kernels/build.sh tex), one subdirectory
# per target folder (gfx1101, gfx1201, gfx1201-fp8, ...), or a flat gfx1101 directory for
# older builds
@@ -111,6 +113,7 @@ if [[ "$VARIANT" != clean ]]; then
cp "$D4R_BUNDLE_DLSS" "$STAGE/d4r/nvngx_dlss.dll"
: "${D4R_BUNDLE_NGX:?set D4R_BUNDLE_NGX}"
cp "$D4R_BUNDLE_NGX" "$STAGE/d4r/ngx/_nvngx.dll"
[[ -z "${D4R_BUNDLE_DLSSD:-}" ]] || cp "$D4R_BUNDLE_DLSSD" "$STAGE/d4r/nvngx_dlssd.dll"
else
cp "$ROOT/install.sh" "$STAGE/install.sh"
chmod +x "$STAGE/install.sh"