WIP: feat(dlss): compose neural rendering over native HDR #620

Draft
TheDevil wants to merge 4 commits from TheDevil/Longshot:feat/nr-native-hdr-scale into main
First-time contributor

Type: feat · Risk: high · Tested on: Windows NGX-on/off renderer builds and game-free fixtures · Needs: fresh HDR display/runtime measurements and Linux validation

Why

Preserve Native HDR highlights when using optional NR, and allow its neural-pass cost to be adjusted independently of render/output resolution. This is the HDR/scaling follow-up to #619, split from #173.

What changed

NR sees a bounded scene proxy. Its model edits are composed as a residual onto the original linear HDR scene, preserving highlights instead of routing the entire output through an SDR clamp. Identity NR output is a no-op before half-float rounding. Native HDR routes after the upscaler once per frame. SDR Stage supports Before/After; frame snapshots prevent a menu edit from evaluating twice. NR resolution scale resamples scene/depth/motion and composes back to original output dimensions.

This is stacked on #619; review child e3464f4cee against parent d6a6ba9915. The upstream diff includes its parent until #619 lands. API remains 22. No keyboard, wheel or cap change. No patched-runtime bridge, alternate runtime loader or new application ID.

Underlying NR work is credited to HypeZ85 / Discord valerio85, Hookshot PR #1590, a1f730de8c8e7b2adfbca4e0b8ac4cfbdf72834c.

Measurements

Verdict: HDR/scaling renderer links and game-free adapter/menu/shader checks pass. CPU fixtures and shader compilation do not establish HDR display correctness or a GPU performance improvement.

Before: #619 @ 95126d5729
After: e3464f4cee
Hardware: Windows x64, i7-14700F, 16 GB; GPU/driver/display not exercised.
Scene: authored frame/NGX fixtures and shader compilation, no gameplay rendered.
Method: production adapter extracted with fake Vulkan/NGX, original shader compilation and SPIR-V correspondence, full regression suite.
How to reproduce: python -I -B tests/run_all.py --jobs 5; renderer-only RX_VK_ONLY=1 python -I -B nx2/build.py --standalone --jobs 4 with NGX SDK configured.

Full suite at refreshed head: 542 passed, 13 failed, 35 skipped (201 s). All failures also fail on main @ 2b1d38c6: tests/test_appimage_player_build.py, tests/test_cpm_discovery.py, tests/test_crash_dialog.py, tests/test_env_on.py, tests/test_lift_cleanup_error.py, tests/test_linux_preflight.py, tests/test_make_game_cache.py, tests/test_oot_state_tap.py, tests/test_readback_late.py, tests/test_tested_configurations.py, tests/test_vk_pgo.py, tests/test_vram_budget_row.py, tests/test_walk_key.py. Main had 530 passed, 14 failed, 34 skipped; test_finish_output passed in this run. No new failing checks.

Baseline: #619 is the comparison because this change depends on its regular NGX port.

Check Before: NR parent @ 95126d57 After: this PR @ e3464f4c
Game-free suite 541 pass, 13 baseline failures, 34 skip 542 pass, same 13 failures, 35 skip
HDR proxy / scaled stage routing SDR fallback only fixture passes
Windows renderer SDK on/off both link both link

Flags and settings

NR stays off by default (dlss5=0). NR resolution scale defaults to 100%; it affects only the neural pass, independently of DLSS quality/render/output settings. SDR Stage defaults to Before; Native HDR forces After. Optional ini keys dlss5_scale and dlss5_stage persist through Compare Save/Cancel. No additional environment switches. Parent NR requirements/overrides remain as documented in docs/dlss5-neural-rendering.md.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
dlss5_scale menu/ini absent 100% independent neural-pass scale opt-in; live GPU/device behavior pending 100% until measured
dlss5_stage menu/ini absent 0 (Before) SDR routing; Native HDR forces After opt-in; live GPU/device behavior pending Before by default

Testing

Tested: Windows renderer link, stage routing/one evaluation per frame, stale UI HDR flag versus actual frame mode, HDR proxy/composition selection, scaled before/after dimensions, invalid inputs, repeated failure fallback, model/menu transaction tests and source/SPIR-V correspondence.

Not tested: fresh game with a compatible unmodified NR runtime, HDR display/capture quality, GPU time/VRAM, physical resize/device changes, Linux host/renderer/runtime. Installed game untouched. Earlier combined patched-runtime results are not evidence for this source split.

Must be tested:

  • Windows, supported GPU/runtime and HDR display: compare NR Off/On in bright, dark and saturated scenes, UI, scene changes, resize, scale/stage edits and unavailable runtime, expecting preserved highlights, correct color/alpha, one NR evaluation per frame and graceful fallback (by hand).
  • Linux: build and native runtime gate, expecting compilation and unchanged base rendering when unavailable (by hand).

Risks

Proxy/residual composition may alter saturation, highlight detail, temporal stability or half-float precision with some models. Scaling may reduce detail or introduce resampling artifacts; measurement is required to choose a useful scale. Disable NR to retain ordinary rendering; reverting this child restores the SDR-only parent.

Compatibility: API/save/cache formats unchanged. New optional keys default to existing full-size Before behavior for SDR. Native HDR now uses a separate pass; host and base NR prerequisites remain unchanged. No vendor runtime or game assets included; checked-in SPIR-V headers are source companions.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance and upstream NR credit recorded.
  • New settings/defaults and HDR routing documented.
  • Source/SPIR-V and regression fixtures updated.
  • Fresh unmodified-runtime HDR game measurements and docs/tested fragment, pending WIP.
  • Linux host/renderer build/runtime checks, pending WIP.

Upstream refresh

Current head e3464f4cee34dd73d4ae55f048cdc71f26253e33 incorporates main snapshot 6c9edffe through the refreshed NR parent d6a6ba99152333a189def02c126105c74a01dd7c, with published history preserved. Final full run: 542 passed, 13 baseline failures, 35 skipped in 201 seconds. No new failures. The added upstream Linux pipe-security check is skipped on Windows. The literal rebase checkbox remains pending because main was merged, not rewritten. Fresh game/unmodified-runtime/HDR-display/Linux validation remains WIP.

**Type:** feat · **Risk:** high · **Tested on:** Windows NGX-on/off renderer builds and game-free fixtures · **Needs:** fresh HDR display/runtime measurements and Linux validation ## Why Preserve Native HDR highlights when using optional NR, and allow its neural-pass cost to be adjusted independently of render/output resolution. This is the HDR/scaling follow-up to #619, split from #173. ## What changed NR sees a bounded scene proxy. Its model edits are composed as a residual onto the original linear HDR scene, preserving highlights instead of routing the entire output through an SDR clamp. Identity NR output is a no-op before half-float rounding. Native HDR routes after the upscaler once per frame. SDR Stage supports Before/After; frame snapshots prevent a menu edit from evaluating twice. NR resolution scale resamples scene/depth/motion and composes back to original output dimensions. This is stacked on #619; review child e3464f4cee34dd73d4ae55f048cdc71f26253e33 against parent d6a6ba99152333a189def02c126105c74a01dd7c. The upstream diff includes its parent until #619 lands. API remains 22. No keyboard, wheel or cap change. No patched-runtime bridge, alternate runtime loader or new application ID. Underlying NR work is credited to **HypeZ85 / Discord valerio85**, [Hookshot PR #1590](https://github.com/NotRexed/Hookshot/pull/1590), a1f730de8c8e7b2adfbca4e0b8ac4cfbdf72834c. ## Measurements **Verdict:** HDR/scaling renderer links and game-free adapter/menu/shader checks pass. CPU fixtures and shader compilation do not establish HDR display correctness or a GPU performance improvement. Before: #619 @ 95126d5729 After: e3464f4cee34dd73d4ae55f048cdc71f26253e33 Hardware: Windows x64, i7-14700F, 16 GB; GPU/driver/display not exercised. Scene: authored frame/NGX fixtures and shader compilation, no gameplay rendered. Method: production adapter extracted with fake Vulkan/NGX, original shader compilation and SPIR-V correspondence, full regression suite. How to reproduce: `python -I -B tests/run_all.py --jobs 5`; renderer-only `RX_VK_ONLY=1 python -I -B nx2/build.py --standalone --jobs 4` with NGX SDK configured. Full suite at refreshed head: **542 passed, 13 failed, 35 skipped** (201 s). All failures also fail on main @ 2b1d38c6: `tests/test_appimage_player_build.py`, `tests/test_cpm_discovery.py`, `tests/test_crash_dialog.py`, `tests/test_env_on.py`, `tests/test_lift_cleanup_error.py`, `tests/test_linux_preflight.py`, `tests/test_make_game_cache.py`, `tests/test_oot_state_tap.py`, `tests/test_readback_late.py`, `tests/test_tested_configurations.py`, `tests/test_vk_pgo.py`, `tests/test_vram_budget_row.py`, `tests/test_walk_key.py`. Main had 530 passed, 14 failed, 34 skipped; test_finish_output passed in this run. No new failing checks. Baseline: #619 is the comparison because this change depends on its regular NGX port. | Check | Before: NR parent @ 95126d57 | After: this PR @ e3464f4c | |---|---|---| | Game-free suite | 541 pass, 13 baseline failures, 34 skip | 542 pass, same 13 failures, 35 skip | | HDR proxy / scaled stage routing | SDR fallback only | fixture passes | | Windows renderer SDK on/off | both link | both link | ### Flags and settings NR stays off by default (`dlss5=0`). NR resolution scale defaults to 100%; it affects only the neural pass, independently of DLSS quality/render/output settings. SDR Stage defaults to Before; Native HDR forces After. Optional ini keys `dlss5_scale` and `dlss5_stage` persist through Compare Save/Cancel. No additional environment switches. Parent NR requirements/overrides remain as documented in docs/dlss5-neural-rendering.md. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | dlss5_scale | menu/ini | absent | 100% | independent neural-pass scale | opt-in; live GPU/device behavior pending | 100% until measured | | dlss5_stage | menu/ini | absent | 0 (Before) | SDR routing; Native HDR forces After | opt-in; live GPU/device behavior pending | Before by default | ## Testing **Tested:** Windows renderer link, stage routing/one evaluation per frame, stale UI HDR flag versus actual frame mode, HDR proxy/composition selection, scaled before/after dimensions, invalid inputs, repeated failure fallback, model/menu transaction tests and source/SPIR-V correspondence. **Not tested:** fresh game with a compatible unmodified NR runtime, HDR display/capture quality, GPU time/VRAM, physical resize/device changes, Linux host/renderer/runtime. Installed game untouched. Earlier combined patched-runtime results are not evidence for this source split. **Must be tested:** - Windows, supported GPU/runtime and HDR display: compare NR Off/On in bright, dark and saturated scenes, UI, scene changes, resize, scale/stage edits and unavailable runtime, expecting preserved highlights, correct color/alpha, one NR evaluation per frame and graceful fallback (by hand). - Linux: build and native runtime gate, expecting compilation and unchanged base rendering when unavailable (by hand). ## Risks Proxy/residual composition may alter saturation, highlight detail, temporal stability or half-float precision with some models. Scaling may reduce detail or introduce resampling artifacts; measurement is required to choose a useful scale. Disable NR to retain ordinary rendering; reverting this child restores the SDR-only parent. **Compatibility:** API/save/cache formats unchanged. New optional keys default to existing full-size Before behavior for SDR. Native HDR now uses a separate pass; host and base NR prerequisites remain unchanged. No vendor runtime or game assets included; checked-in SPIR-V headers are source companions. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [ ] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance and upstream NR credit recorded. - [x] New settings/defaults and HDR routing documented. - [x] Source/SPIR-V and regression fixtures updated. - [ ] Fresh unmodified-runtime HDR game measurements and docs/tested fragment, pending WIP. - [ ] Linux host/renderer build/runtime checks, pending WIP. ## Upstream refresh Current head `e3464f4cee34dd73d4ae55f048cdc71f26253e33` incorporates main snapshot `6c9edffe` through the refreshed NR parent `d6a6ba99152333a189def02c126105c74a01dd7c`, with published history preserved. Final full run: 542 passed, 13 baseline failures, 35 skipped in 201 seconds. No new failures. The added upstream Linux pipe-security check is skipped on Windows. The literal rebase checkbox remains pending because main was merged, not rewritten. Fresh game/unmodified-runtime/HDR-display/Linux validation remains WIP.
feat(dlss): port regular NGX neural rendering controls
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
95126d5729
Based on HypeZ85 (Discord valerio85), Hookshot PR #1590 at a1f730de8c8e7b2adfbca4e0b8ac4cfbdf72834c. Uses the regular NGX path; excludes the patched runtime bridge.

Assisted-by: Codex
feat(dlss): compose neural rendering over native HDR
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
b557e74c0f
Add frame-latched stage selection and independent NR resolution scale on top of the regular NGX NR port. Underlying NR credit: HypeZ85 (Discord valerio85), Hookshot PR #1590.

Assisted-by: Codex
Merge current main into regular NGX port
Some checks are pending
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 6s
Website / Website on Cloudflare (pull_request_target) Has been skipped
d6a6ba9915
Assisted-by: Codex
Merge refreshed NGX port into HDR composition
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
e3464f4cee
Assisted-by: Codex
Author
First-time contributor

Refreshed onto main snapshot 6c9edffe through parent #619 without rewriting history. Final head e3464f4cee: 542 passed, 13 baseline failures, 35 skipped in the full Windows game-free suite (201 s). NGX-on/off renderer builds succeeded; production renderer source is unchanged by the upstream merge. Fresh HDR display/unmodified-runtime/Linux validation remains pending; still WIP.

Refreshed onto main snapshot 6c9edffe through parent #619 without rewriting history. Final head e3464f4cee34dd73d4ae55f048cdc71f26253e33: 542 passed, 13 baseline failures, 35 skipped in the full Windows game-free suite (201 s). NGX-on/off renderer builds succeeded; production renderer source is unchanged by the upstream merge. Fresh HDR display/unmodified-runtime/Linux validation remains pending; still WIP.
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
This pull request has changes conflicting with the target branch.
  • gpu/vk/menu_i18n.h
  • gpu/vk/vk_menu.cpp
  • tests/test_framegen_preset.py
  • tests/test_menu_keys.py
  • tests/test_upscaler_round_trip.py
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/nr-native-hdr-scale:TheDevil-feat/nr-native-hdr-scale'
git switch 'TheDevil-feat/nr-native-hdr-scale'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!620
No description provided.