rr: add FSR Ray Regeneration, exact RDNA3 inference and motion experiments

Add an experimental FSR Ray Regeneration backend for D3D12 RR requests:
- Convert depth, motion, normals and albedos into AMD denoiser inputs.
- Split and recompose diffuse/specular signals, then run Super Sampling.
- Add stability/detail controls, demodulation guards and halo limiting.
- Handle AMD provider discovery under NVIDIA GPU spoofing.
- Add runtime probes, synthetic reference scenes and per-dispatch profiling.

Add exact gfx11 DLSS-RR inference using f16 cooperative matrices:
- Reproduce FP8 conversions, accumulation and camera reprojection arithmetic.
- Widen model weights and avoid requiring VK_EXT_shader_float8.
- Extend model building, replay tools and descriptor metadata.

Expand motion preprocessing and experimental AW2 native-motion support:
- Add tiled LDS dilation, padded allocation handling and thin-only sky fill.
- Order dilation with input waits and NGX on the selected stream.
- Add jitter-aligned native composition, hybrid routing and wire history repair.
- Add prepared masks, sparse repair and independent motion/repair controls.

Add optional fused R11G11B10 input/output conversion, sampled stage timings
and profile summarization. Extend configuration, packaging, documentation,
FidelityFX headers and CPU/GPU regression coverage.
This commit is contained in:
ayo committed 2026-10-16 04:55:25 -04:00
1 parent 17c1828f97
commit 34e6b0fe71
83 files changed
+11300 -195

No files matched your search

+61 -1
View File
@@ -7,7 +7,8 @@ import unittest
ROOT = Path(__file__).resolve().parents[1]
CONFIG = ROOT / "scripts" / "d4r_config.py"
RR_VARIABLES = ("D4R_RR_ENABLE", "D4R_RR_PRESET")
RR_VARIABLES = ("D4R_RR_ENABLE", "D4R_RR_PRESET", "D4R_RR_BACKEND", "D4R_FSR_RR_DLL", "D4R_FSR_RR_STABILITY_BIAS",
"D4R_FSR_RR_DETAIL")
def run_config(text, **overrides):
@@ -68,5 +69,64 @@ class RayReconstructionConfigTests(unittest.TestCase):
self.assertNotIn("D4R_RR_PRESET", decided)
class RayReconstructionBackendTests(unittest.TestCase):
"""[RayReconstruction] Backend picks the denoiser; it never changes the DLSS presets."""
def test_default_leaves_dlss_in_place(self):
code, decided = run_config("[RayReconstruction]\nEnable = true\n")
self.assertEqual(code, 0)
self.assertNotIn("D4R_RR_BACKEND", decided) # the shim's default is dlss
def test_backends_are_exported_and_independent_of_presets(self):
for backend in ("dlss", "fsr", "FSR"):
with self.subTest(backend=backend):
code, decided = run_config(f"[RayReconstruction]\nBackend = {backend}\nModel = E\n[DLSS]\nModel = K\n")
self.assertEqual(code, 0)
self.assertEqual(decided["D4R_RR_BACKEND"], backend.lower())
self.assertEqual(decided["D4R_RR_PRESET"], "5")
self.assertEqual(decided["D4R_DLSS_PRESET"], "11")
def test_unknown_backend_is_rejected(self):
for value in ("amd", "fsr4", "native"):
with self.subTest(value=value):
code, decided = run_config(f"[RayReconstruction]\nBackend = {value}\n")
self.assertNotEqual(code, 0)
self.assertNotIn("D4R_RR_BACKEND", decided)
def test_denoiser_path_and_environment_precedence(self):
code, decided = run_config("[RayReconstruction]\nBackend = fsr\nFsrDenoiser = /opt/amd/denoiser.dll\n")
self.assertEqual(code, 0)
self.assertEqual(decided["D4R_FSR_RR_DLL"], "/opt/amd/denoiser.dll")
code, decided = run_config("[RayReconstruction]\nBackend = fsr\n", D4R_RR_BACKEND="dlss")
self.assertEqual(code, 0)
self.assertNotIn("D4R_RR_BACKEND", decided)
def test_templates_keep_dlss_as_the_default(self):
import configparser
for name in ("config/d4r.ini.default", "packaging/d4r.ini"):
ini = configparser.ConfigParser(inline_comment_prefixes=(";",))
ini.read(ROOT / name)
self.assertEqual(ini.get("RayReconstruction", "Backend"), "dlss", name)
self.assertEqual(ini.get("RayReconstruction", "FsrDenoiser"), "auto", name)
self.assertEqual(ini.get("RayReconstruction", "FsrStabilityBias"), "auto", name)
self.assertEqual(ini.get("RayReconstruction", "FsrDetail"), "0", name)
def test_fsr_tuning_keys(self):
code, decided = run_config("[RayReconstruction]\nBackend = fsr\nFsrStabilityBias = auto\nFsrDetail = 0.25\n")
self.assertEqual(code, 0)
self.assertNotIn("D4R_FSR_RR_STABILITY_BIAS", decided) # auto: AMD's own default
self.assertEqual(decided["D4R_FSR_RR_DETAIL"], "0.25")
code, decided = run_config("[RayReconstruction]\nFsrStabilityBias = 0\n")
self.assertEqual(code, 0)
self.assertEqual(decided["D4R_FSR_RR_STABILITY_BIAS"], "0")
for text in ("FsrStabilityBias = -1", "FsrStabilityBias = low", "FsrDetail = 1.5", "FsrDetail = x"):
with self.subTest(text=text):
code, _ = run_config(f"[RayReconstruction]\n{text}\n")
self.assertNotEqual(code, 0)
code, decided = run_config("[RayReconstruction]\nFsrStabilityBias = 0\n", D4R_FSR_RR_STABILITY_BIAS="1")
self.assertEqual(code, 0)
self.assertNotIn("D4R_FSR_RR_STABILITY_BIAS", decided)
if __name__ == "__main__":
unittest.main()