Skip to content

Add the DLSS (nvngx) backend with a CPU-only unit test - #1

Closed
xiaochen200000 wants to merge 1 commit into
avivetech:mainfrom
xiaochen200000:feat/dlss-nvngx-backend
Closed

xiaochen200000 wants to merge 1 commit into
avivetech:mainfrom
xiaochen200000:feat/dlss-nvngx-backend

Conversation

@xiaochen200000

Copy link
Copy Markdown

claiming: DLSS (nvngx) backend provider port

This is the continuation of the DLSS integration that was going in against the original It's-NotRexed repository (upstream issue/PR thread went dark when the GitHub project was removed; the git mirror at git.notrexed.dev is down at the moment). Rebased onto this runtime: the FFX-facing surface now bridges from ffx::DispatchDescUpscale (runtime/src/dlss_backend.cpp ffx_to_native), the NGX ABI declarations live beside the FFX subset the repo already vendors (runtime/test/nvngx_api_min.h next to ffx_api_min.h), and the unit test follows the own-main PASS/FAIL style of the other CPU tests.

What lands here

  • runtime/test/nvngx_api_min.h — the NGX ABI subset written out from the driver's NGX Core export table (nvngx.dll 310.x D3D12 section) and the public DLSS Programming Guide 310.6: export names, the 17-slot parameter vtable, result codes (RESULT_FAIL_OUT_OF_DATE = RESULT_FAIL | 12 — the deprecated GetParameters fallback story), FeatureCommonInfo's shipped 40-byte record (16B path list + opaque internal + 16B inline logging) pinned by static_assert, the six per-slot preset keys, and the shipped PerfQualityValue/PresetValue enum numbering. Nothing from NVIDIA's SDK is vendored (their license forbids redistributing it under an open-source license) — only written-out declarations from the ABI and the public guide, same discipline ffx_api_min.h applies to AMD's.
  • runtime/src/dlss_backend.{h,cpp} — the translation surface and the process-level wrap:
    • pick_quality(ratio) over the FFX mode's ratio with the shipped-enum collisions resolved conservatively (1.7237x keeps Balanced, 2.0–3.0 folds into UltraQuality, the 1.71 cut is where the shipped values stop differing);
    • create_flags from the measured 1.0.2.1 context (HDR + low-res MVs + inverted depth + auto exposure);
    • the shipped helper's 0-means-1.0 MV-scale rule;
    • fill_create_params / fill_eval_params in the shipped helpers' exact key and type order (NGX_D3D12_CREATE_DLSS_EXT / NGX_D3D12_EVALUATE_DLSS_EXT), with the preset hint riding the create bag before CreateFeature (guide 3.12: the slot pick is read at creation) and refreshed per eval;
    • Core load by name (LEONIDA_NGX_DLL override), init with the 40B info record, capability gate (SuperSampling.Available + min-driver), feature create/evaluate/release;
    • ffx_to_native: the bridge from the game's ffx::DispatchDescUpscale (jitter/MV scale pass-through, sharpening on the deprecated key, reset).
  • runtime/test/dlss_backend_unit_test.cpp — CPU-only, own-main PASS/FAIL: a recording mock of the parameter ABI drives the create/eval bags' key-and-type-order checks (helper order, preset on the create bag, PRESET_DEFAULT leaving the key unset so the driver's OTA default stays); pins the shipped enum numbering (E5/F6/J10/K11/L12/M13) and the result-code family; sweeps 1.0..4.5 @0.001 (3,501 points) against an independent table-driven reference.
  • runtime/CMakeLists.txt — dlss_backend_test registered like the other CPU tests, ctest-gated.
  • docs/upscaler_backends.md — the component/license map (what the package ships, what it can reach on PC, per-component redistribution terms), indexed from docs/README.md.

Compliance

No game data (text and hashes only — checked against no-game-data.yml's extension list), no NVIDIA SDK source or headers, no keys or workarounds. The NGX declarations carry their own written-out provenance comments, as ffx_api_min.h does for FFX.

Verification

Unit test runs everywhere (no device, no NGX, no DLL needed): the mock records every Set, so key/type order drift shows as a bag diff; CI compiles the .cpp with /W4 (the real-NGX path stays exercised by hand or a later GPU run, same story as fsr_dispatch_test).

The DLSS side of the upscaler landscape docs/upscaler_backends.md maps, as code:

- runtime/test/nvngx_api_min.h: the NGX ABI subset written out from the driver's export table and the
  public DLSS Programming Guide 310.6 — export names, the 17-slot parameter vtable, result codes
  (OUT_OF_DATE = FAIL|12 for the deprecated GetParameters fallback), FeatureCommonInfo's shipped 40-byte
  layout (16B path list + internal + 16B logging) pinned by static_assert, and the per-slot preset keys.
  Nothing from NVIDIA's SDK is vendored; their license forbids it.
- runtime/src/dlss_backend.{h,cpp}: the pure translation surface — pick_quality over the FFX mode's ratio
  (the shipped-enum collisions resolve conservatively: 1.7237x keeps Balanced, 2.0-3.0 folds into
  UltraQuality), create_flags from the measured 1.0.2.1 context, the shipped helper's 0-means-1.0 MV rule,
  the create/eval bags in the shipped helpers' exact key and type order with the preset hint riding the
  create bag before CreateFeature (guide 3.12) and refreshed per eval — plus the process-level Core load,
  init with the 40B info record, capability gate, feature create/evaluate/release, and the FFX bridge
  (ffx_to_native) from the game's ffx::DispatchDescUpscale.
- runtime/test/dlss_backend_unit_test.cpp: CPU-only test. A recording mock of the parameter ABI drives
  fill_create_params/fill_eval_params key-and-type-order checks (helper order, preset on the create bag,
  PRESET_DEFAULT leaving the key unset), pins the shipped enum numbering and the result-code family, and
  sweeps 1.0..4.5 @0.001 against a table-driven reference (3,501 points).
- runtime/CMakeLists.txt: dlss_backend_test registered like the other CPU tests, ctest-gated.
- docs/upscaler_backends.md: the component/license map, indexed from docs/README.md.

No game data, no NVIDIA SDK source, no keys.
@xiaochen200000
xiaochen200000 deleted the feat/dlss-nvngx-backend branch November 24, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant