; Modified in this fork for CUDA Ray Reconstruction support and validation (2026). ; d4r configuration: official NVIDIA DLSS on AMD (ZLUDA + Wine CUDA bridge + NGX shim) ; ; Read by scripts/run_game_d4r_optiscaler_proton.sh at every game launch. The first launch copies ; this file to ~/.config/d4r/d4r.ini (or D4R_CONFIG); edit that copy. Changes apply at the next launch. ; ; Every value can be left as "auto" (or empty) to keep the built-in default. An environment variable ; set before launching (e.g. D4R_DLSS_PRESET=11) always wins over this file. ; Paths may use ~ for your home directory. [Launch] ; Used by scripts/d4r_play.sh (one-command launch). Examples: ; ProtonDir = ~/.local/share/Steam/compatibilitytools.d/GE-Proton11-3 ; CompatDataDir = ~/.local/share/Steam/steamapps/compatdata/ ; GameExe = ~/Games/MyGame/Binaries/Win64/MyGame-Win64-Shipping.exe ProtonDir = CompatDataDir = GameExe = [DLSS] ; DLSS model recommendations: ; ; Model | DLSS | Recommended modes | Notes ; ------+-------+---------------------------------+---------------------------------- ; K | 4 | DLAA / Quality / Balanced | Default; faster alternative to M/L ; M | 4.5 | Performance | More demanding on RDNA3 ; L | 4.5 | Ultra Performance | Especially 4K; experimental ; E | 3 CNN | Quality / Balanced / Performance | Legacy faster fallback; the engine's choice on RDNA2 ; F | 3 CNN | DLAA / Ultra Performance | Deprecated; prefer K or L ; ; On the engine ([Engine]) E and F run from engine\e and engine\f (build-engine-models.sh) without cooperative ; matrices, so they are the models for RDNA2 GPUs (Steam Deck: about 5 ms at 640x360 -> 1280x720). ; ; Select the upscaling mode separately in game/OptiScaler. These are recommendations; ; other modes are allowed. L requires the L texture build. ; Aliases: CNN = E, DLSS4 = K, DLSS4.5 = M. A/B/C/D/G/J use K in this DLL version. ; auto = use the game/OptiScaler choice. Benchmarks: docs/performance.md. Model = K [RayReconstruction] ; Runs NVIDIA's nvngx_dlssd.dll denoiser, separate from Super Resolution. ; auto enables the CUDA route when the NGX core reports the denoiser initialized and available. ; false disables it. Select Ray Reconstruction and ray tracing in the game. ; RR D/E temporal validation on gfx1201 requires native FP8 WMMA ([Kernels] NativeFp8 = true). ; The scalar FP8 RR path is not validated. Enable = auto ; auto preserves the game's choice; default = NVIDIA's default, D/E = transformer models. ; These presets are independent of [DLSS] Model. E requires a DLL that contains that model. Model = auto ; Which denoiser answers a game's Ray Reconstruction request (D4R_RR_BACKEND): ; dlss = NVIDIA's DLSS Ray Reconstruction (Model above), the default. ; fsr = experimental: AMD's FSR Ray Regeneration 1.2 (amd_fidelityfx_denoiser_dx12.dll, unmodified) ; denoises at render resolution, then Super Sampling ([DLSS] Model) upscales to the game's ; output size. D3D12 only. The game's combined colour is split into diffuse and specular ; by its albedos, which is an approximation; see docs/fsr-ray-regeneration.md. ; Changing it needs a game restart (or the game recreating its Ray Reconstruction feature). Backend = dlss ; The AMD denoiser DLL for Backend = fsr (D4R_FSR_RR_DLL). auto: amd_fidelityfx_denoiser_dx12.dll in ; the d4r folder. FsrDenoiser = auto ; Backend = fsr tuning. FsrStabilityBias: the AMD denoiser's temporal stability bias; auto = AMD's ; default (1), which blurs reflections and fine detail; 0 measured sharper and closer to the noise-free ; truth, moving or still (D4R_FSR_RR_STABILITY_BIAS). FsrDetail: the share (0-1) of the colour that goes ; around the denoiser, keeping detail it removes as noise (hair, water ripples, foliage) at the cost of some ; grain; 0 = off (D4R_FSR_RR_DETAIL). FsrStabilityBias = auto FsrDetail = 0 [Latency] ; How many frames old the upscaled image the game presents may be. ; 0 = same frame (no added latency, no trailing artefacts; needs VkD3DDir below) ; 1 = at most 1 frame old ; 2 = 2 frames old (roughly +20% fps with DLSS 4.5, adds ~2 frames of input latency, ; fast motion can trail) ; 3 = 2-3 frames old (about the same fps as 2 in practice) FrameAge = 0 [Kernels] ; Prefer NVIDIA's original arithmetic over speed for every native kernel and the translated fallback. ; Restores intermediate FP8 quantization, per-MMA f16 rounding and original denormal handling; keeps ; NGX's synchronizations. Selects accuracy variants in NativeKernelDir*/accuracy (or a marked accuracy ; directory directly). Missing accuracy kernels use translated PTX, never the fast set. Slower; this ; aims for fidelity, but RTX image parity is not proven. (D4R_PREFER_ACCURACY) PreferAccuracy = false ; false: use original translated enc1/enc2 layers for L/M, retaining other native kernels. ; Reduces the native encoders' motion trails seen in Townfall; best paired with PreferAccuracy. ; Costs some GPU time. Manifest required for selective fallback; flat sets fall back entirely. ; (D4R_NATIVE_SWIN_ENCODERS) NativeSwinEncoders = true ; Native RDNA3 / RDNA4 kernels for the DLSS 4 and 4.5 network layers (replace ZLUDA's translated code). ; fast = native kernels with relaxed numerics (unless PreferAccuracy is true) ; exact = a separately built directory with conservative FP8/f16 rounding; not an RTX parity guarantee ; off = ZLUDA-translated kernels only ; fast/exact need the code objects built by the native-kernel tools ([Paths] NativeKernelDir*). NativeKernels = off ; FP8 tensor-core emulation on RDNA3 WMMA (much faster than the scalar path). Fp8Wmma = true ; RDNA4 only: FP8 MMAs on the native FP8 WMMA (and the -fp8 native kernel variants); off widens FP8 to f16 as ; on RDNA3. Ignored on other GPUs. (D4R_ZLUDA_WMMA_FP8_NATIVE) NativeFp8 = true ; Drop per-instruction flush-to-zero mode switches in ZLUDA-compiled kernels ; (only values below ~1e-38 differ; a little faster). IgnoreDenormals = true ; Thread-block bound assumed for kernels without launch bounds (256 avoids register spills). ImplicitMaxBlock = 256 [Interop] ; Experimental foreground motion coverage for thin geometry. 0 = original vectors; ; 1/2 = opaque-surface dilation radius in render pixels; both automatically fill sky gaps ; from the nearest foreground within 8 render pixels. Needs render- or display-resolution, unjittered motion vectors ; and same-frame linear VRAM inputs; unsupported features retain original vectors. ; Default off. May affect disocclusion edges. (D4R_MOTION_DILATION) MotionVectorDilation = 0 ; Opt-in sky-fill experiment for equal render/motion grids: borrow only from foreground ; runs <=3 pixels along either axis. Opaque dilation is unchanged. Restart to change. ; Unsupported routes retain nearest-foreground fill. (D4R_MOTION_THIN_SKY) MotionDilationThinSky = false ; Keep DLSS inputs and output in VRAM (vkd3d-proton Vulkan interop) instead of copying through ; system memory. Falls back automatically when the game's resources do not qualify. VramInterop = true ; Wait for the input copies before DLSS runs (prevents beaded thin lines in motion). Keep on. InputSync = true ; Faster hand-offs between the game and DLSS (same frame, same result). Need FrameAge = 0 and VRAM ; interop, and a runtime built from this checkout (scripts/install_d4r_runtime.sh). ; Input readiness uses adaptive CPU polling by default. D4R_SHIM_GPU_INPUT_WAIT=1 enables experimental ; null-stream GPU waits for same-frame Super Sampling; diagnostics and host input reads retain CPU waits. ; LinearInputs: DLSS reads the game's inputs in place once the input marker is ready ; DirectOutput: the result is written straight into the game-side buffer (preset K, and only while ; NGX runs the native output kernel; drops NVIDIA's "DLSS SDK" watermark) ; ElideNgxSync: removes NGX's internal CPU waits between its GPU stages ; EvalSync = false: no CPU wait between DLSS and the output copy ; MarkerPollUs: auto learns readiness and yields near it; N fixes the poll interval in microseconds LinearInputs = true DirectOutput = true ElideNgxSync = true EvalSync = false MarkerPollUs = auto [Engine] ; Experimental. Runs DLSS 4 and 4.5 (models K, L and M) and DLSS 3's CNN (models E and F) on d4r's own Vulkan ; inference engine instead of NVIDIA's ; kernels through ZLUDA: the whole evaluation is recorded into the game's own command list, the game shows the ; result of the frame it just rendered, and FrameAge and the [Interop] hand-off settings do not apply. ; Needs VkD3DDir, a driver with VK_KHR_cooperative_matrix (Mesa RADV on RDNA3/RDNA4) and the model folders ; (RuntimeDir/engine/k, k-ldr, m, m-ldr, l, l-ldr; scripts/install_d4r_runtime.sh). E and F (engine/e, engine/f; ; D4R_ENGINE_MODEL_E_DIR, D4R_ENGINE_MODEL_F_DIR) need no cooperative matrices: they run on RDNA2 (Steam Deck) ; too, from any render size and HDR or LDR, with AutoExposure too (models built by this version). A game or setting the engine ; does not cover uses the normal path, with the reason in d4r_nvngx.log: other models than E, F, K, L and M, ; display-resolution motion vectors with L or M, or a K model built before the current engine/compile_k.py for display-resolution ; motion, non-inverted depth or exposure supplied by the game. Details and measurements: engine/README.md. ; (D4R_ENGINE) Enabled = false ; The model K folder for games with the HDR flag: the folder engine/compile_k.py writes (weights extracted ; from your nvngx_dlss.dll plus d4r's shaders). auto = RuntimeDir/engine/k, where scripts/install_d4r_runtime.sh ; puts D4R_ENGINE_MODEL. The other folders: D4R_ENGINE_MODEL_LDR_DIR, D4R_ENGINE_MODEL_M_DIR, ; D4R_ENGINE_MODEL_M_LDR_DIR, D4R_ENGINE_MODEL_L_DIR and D4R_ENGINE_MODEL_L_LDR_DIR. (D4R_ENGINE_MODEL_DIR) ModelDir = auto ; Where the network between the engine's Vulkan stages runs (K and M). vulkan = the engine's cooperative-matrix ; shader, everything in one command list. hip = d4r's native HIP layer kernels: the game's command list is split ; around the network like a split frame, so it needs VkD3DDir, the CUDA bridge and a model built with --hip; when ; they are missing the Vulkan network runs and the log says why. auto = vulkan. (D4R_ENGINE_NETWORK) Network = auto [Paths] ; auto = defaults of scripts/d4r_proton_env.sh RuntimeDir = auto ; ZLUDA build (directory with libcuda.so / libnvcuda.so) ZludaDir = auto RocmDir = auto ; Matching lifetime-aware d4r vkd3d-proton (both d3d12.dll + d3d12core.dll); required for all shim paths. VkD3DDir = auto ; JIT cache directory (XDG_CACHE_HOME): auto = the default ~/.cache; per-zluda = one per ZLUDA build, ; ~/.cache/d4r-perf-game-jit- (a new ZLUDA build compiles every kernel once on first use) JitCacheDir = auto ; Native kernel code objects, one directory per NativeKernels mode NativeKernelDirFast = auto NativeKernelDirExact = auto [Game] ; Unreal Engine games: extra console variables applied for this launch only (the game's Engine.ini is ; backed up and restored on exit). Example for sharper thin lines in SILENT HILL Townfall: ; EngineIni = ~/.local/share/Steam/steamapps/compatdata//pfx/drive_c/users/steamuser/AppData/Local/Townfall/Saved/Config/Windows/Engine.ini ; Cvars = r.Tonemapper.Sharpen=0;r.SceneColorFringeQuality=0 EngineIni = Cvars = [OptiScaler] ; Switching in game from OptiScaler's menu (Insert): ; - DLSS model: DLSS Settings > tick Render Presets Override, pick the preset (E, K, L or M), Apply Changes. ; Unticking it goes back to [DLSS] Model, as do presets left at DEFAULT. false always uses [DLSS] Model. FollowPresets = true ; - FSR: Upscalers > Upscaler (DX12) > FSR 3.X/4. FSR 4.1 needs an RDNA3/RDNA4 GPU and GE-Proton (which provides ; AMD's FSR 4 library); other GPUs get FSR 3.1. true lets OptiScaler and AMD's FSR see the real GPU (the game ; still sees an NVIDIA one). Fsr4 = true ; OptiScaler's own FPS overlay (top left) FpsOverlay = true ; 0 = simple ... 3 = detailed with frame-time graph FpsOverlayType = 3 LogLevel = 2 ; Override the render resolution OptiScaler requests per quality mode, e.g. 2.0 turns the game's ; "Quality" into Performance-level input (1280x720 for 1440p). auto = the game's choice. QualityRatioQuality = auto QualityRatioBalanced = auto QualityRatioPerformance = auto QualityRatioUltraPerformance = auto ; Any other OptiScaler.ini settings for this launch, "Section.Key=value;Section.Key=value" Extra = [Overlay] ; MangoHud FPS counter (top right) MangoHud = false MangoHudConfig = fps,frametime,frame_timing=0,gpu_stats=0,cpu_stats=0,position=top-right,font_size=36 [Debug] ; Measure stage timings and write sampled timing lines in the shim log (d4r_nvngx.log) Profile = false ; Log the first 5 frames, then every Nth frame. 1 = every frame. Restart after changing. ; FSR RR stage summaries average N completed GPU samples. Env: D4R_PROFILE_LOG_EVERY ProfileLogEvery = 60 ; Log directory (auto = ~/.cache/d4r-dlss-captures/game--