WIP: feat(vk): add an optional ANR frame generation provider #244

Draft
brunobaccari wants to merge 2 commits from brunobaccari/Longshot:feat/longshot-anr-framegen into main
First-time contributor

Why

Players need to choose ANR as an alternative frame-generation provider while retaining the normal Auto and Built-in options. This draft adds the integration and exposes the effective generator and fallback reason; it does not yet demonstrate ANR-generated frames or a performance improvement.

What changed

  • Menu: extend the existing Graphics Frame generation by selector with ANR (experimental). Preserve Auto and Built-in defaults and the existing generic INI/control bridge.
  • Vulkan: add an original optional loader in gpu/vk/vk_anr.cpp, independent of NVIDIA's NGX core and RTX gates. Feed owned temporal depth/motion inputs into the existing frame-generation output and presentation path.
  • Lifecycle: reset history on cuts, skipped sequences and size changes; preserve the internal GPU generator when the provider cannot run. Count ANR only after a complete successful evaluation set, excluding the initial history/reset output.
  • ABI: provide original host parameter storage with an explicit MSVC-compatible callback table, tested by an original MSVC-ABI mock called from llvm-mingw. No ANR implementation or NVIDIA SDK code is vendored.
  • Builder: add the default-off --fetch-anr-runtime flag and scripts/anr_sdk.py. Reuse the existing checked ZIP cache; pin the official FG-V.B15 addon, stage its 19-file runtime subtree, preserve player configuration and modified packages, and emit @@anr-runtime ready only for verified deployment. Never execute the upstream installer, change graphics options or bundle provider binaries/models.
  • Tests/docs: cover selection, inactive-provider behavior, failure paths, lifecycle, output bookkeeping and the cross-compiler parameter ABI; document the external runtime and current limits.

Flags and settings

Flag What it does Default now Recommendation Helps on Doesn't help on Untested on
frame_generation_by=2 / Graphics: Frame generation by → ANR Explicitly requests the optional ANR Vulkan provider Existing 0 Auto remains unchanged; 1 Built-in remains available Experimental opt-in only; keep this PR WIP Intended Windows x64 with a complete external ANR FG-V.B15 addon, fixed multiplier and temporal upscaler inputs Native HDR, automatic refresh-rate interpolation, missing package or inputs use the existing GPU generator with a reason Real ANR execution on every GPU; native Linux provider
--fetch-anr-runtime Downloads the official pinned addon directly, caches it in <work>/anr-sdk, and installs its complete runtime subtree in <game>/anr/ Off; no download without explicit opt-in Use an ANR-enabled builder on Windows x64; requires the release's Microsoft Visual C++ 2015–2022 x64 runtime Fetch/install only; preserves nr_fg.ini and modified packages Does not enable frame generation, run installers, or support native Linux/ARM64 Full builder-to-game launch and real provider execution

Off, Auto and Built-in do not load ANR. The source documents starting with fixed 2x and a temporal upscaler; actual supported counts and output still need validation against the real provider. The game's base FPS remains separate from generated frames.

Measurements

main: d9648863ab (2026-11-13)
this PR: feat/longshot-anr-framegen @ 073d4836c3d7f617507b960ee04a421150f14dc8

Companion Launcher PR: LongshotLauncher PR #50.

Verification main @ d9648863 this PR @ 073d4836
Real ANR provider initialization and generated output Not measured Pending the current local smoke
Same-scene base/generated FPS and frame time Not measured Not measured
Full build and game-free suite on these commits No paired run recorded Pending

The branch has been rebased onto the named main. The existing renderer checks at 0a8504b and downloader checks at ee004cf below are historical preparation, not validation or performance measurements of the rebased head. No generated-frame output or FPS improvement is claimed. Local Launcher/game validation is now being prepared; keep this experimental PR in draft until it is complete.

Testing

Tested: 14 targeted renderer checks, strict Windows syntax compilation of vk_anr.cpp, source/diff checks, and the original cross-ABI fixture at 0a8504b. At ee004cf, 22 downloader tests and the 40 adjacent FFX/NGX/make_game tests passed. A real official ZIP was downloaded, verified and installed into a disposable fake-game directory; a second fetch proved cache reuse without network. No DLL or installer was executed. The fixture exercises numeric and resource-pointer arguments, Reset, unsigned 64-bit precision, null/missing values and invalid numeric conversions. The Vulkan resource layout was checked against the public ABI.

Not tested: full application build including the opt-in download, full game-free suite on the rebased head, Linux compilation/runtime, real ANR Populate/Init/Create/Evaluate/Shutdown, generated output on the RX 5500 XT, live engine switching, resize/DRS/cuts under the real provider, HDR behavior, quality/ghosting, resource usage, performance or default-state cost in the game. Native Linux currently has an unavailable-provider path; it has not been compiled in this validation.

Needs other testers:

  • Real-provider Windows Vulkan testing, initially RX 5500 XT: initialize ANR and prove fixed-2x output, effective maker reporting, input correctness, resize/cut recovery and resource cleanup. Local execution is pending; request to open after the first local smoke, while this remains WIP.
  • Linux build check: compile the unavailable-provider path and verify normal frame generation remains intact; request to open while this remains WIP.

Screenshots

Pending a real in-game run. No mocked menu or synthetic frame is presented as ANR output.

Risk and rollback

The closed provider's Vulkan contract, resource lifetime and output have not yet been validated in the game. Incorrect depth/motion/color inputs may produce artifacts even if evaluation succeeds. Select Auto or Built-in, or remove the optional external package, to return to the normal generator. The downloader leaves manual/modified packages untouched and preserves nr_fg.ini; deployment failure rolls the old package back and retains its backup if rollback itself fails. Existing defaults and NVIDIA capability gates remain intact.

Reviewer notes

Start with the selection/lifecycle gates, vk_anr.cpp, the owned temporal inputs and the original parameter-ABI fixture. The addon remains external: its binary/model redistribution terms have not been established. The ABI mock proves the cross-compiler callback boundary, not compatibility or performance of the actual ANR DLL. This is intentionally a draft/WIP and must not be marked ready until the missing build and real-provider validation are complete.

Issues

Player-requested optional ANR integration. No issue is closed by this draft.

Checklist

For everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description).
  • Rebased on current main. — Head 073d4836 contains main d9648863; current-head validation remains pending.
  • python -I -B tests/run_all.py run and passing (any failure that also fails on main is named above). — Targeted checks only so far.
  • Tested in the game, or what wasn't is named under Testing. — Real-provider execution remains pending.
  • Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests). — Requests to open are explicitly identified while WIP.
  • Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. — No game measurements yet.
  • 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. — Original adapter/tests using public interface facts; no ANR binary, model or implementation included.

If applicable

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Flags noted, and the switch reference updated (docs/development.md, the README).
  • Screenshots for a change that shows on screen. — Pending the game run.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. — Windows fixtures/syntax pass; full builds and Linux are pending.
  • Docs updated.
## Why Players need to choose ANR as an alternative frame-generation provider while retaining the normal Auto and Built-in options. This draft adds the integration and exposes the effective generator and fallback reason; it does not yet demonstrate ANR-generated frames or a performance improvement. ## What changed - Menu: extend the existing Graphics **Frame generation by** selector with **ANR (experimental)**. Preserve Auto and Built-in defaults and the existing generic INI/control bridge. - Vulkan: add an original optional loader in `gpu/vk/vk_anr.cpp`, independent of NVIDIA's NGX core and RTX gates. Feed owned temporal depth/motion inputs into the existing frame-generation output and presentation path. - Lifecycle: reset history on cuts, skipped sequences and size changes; preserve the internal GPU generator when the provider cannot run. Count ANR only after a complete successful evaluation set, excluding the initial history/reset output. - ABI: provide original host parameter storage with an explicit MSVC-compatible callback table, tested by an original MSVC-ABI mock called from llvm-mingw. No ANR implementation or NVIDIA SDK code is vendored. - Builder: add the default-off `--fetch-anr-runtime` flag and `scripts/anr_sdk.py`. Reuse the existing checked ZIP cache; pin the official FG-V.B15 addon, stage its 19-file runtime subtree, preserve player configuration and modified packages, and emit `@@anr-runtime ready` only for verified deployment. Never execute the upstream installer, change graphics options or bundle provider binaries/models. - Tests/docs: cover selection, inactive-provider behavior, failure paths, lifecycle, output bookkeeping and the cross-compiler parameter ABI; document the external runtime and current limits. ## Flags and settings | Flag | What it does | Default now | Recommendation | Helps on | Doesn't help on | Untested on | |---|---|---|---|---|---|---| | `frame_generation_by=2` / Graphics: Frame generation by → ANR | Explicitly requests the optional ANR Vulkan provider | Existing `0` Auto remains unchanged; `1` Built-in remains available | Experimental opt-in only; keep this PR WIP | Intended Windows x64 with a complete external ANR FG-V.B15 addon, fixed multiplier and temporal upscaler inputs | Native HDR, automatic refresh-rate interpolation, missing package or inputs use the existing GPU generator with a reason | Real ANR execution on every GPU; native Linux provider | | `--fetch-anr-runtime` | Downloads the official pinned addon directly, caches it in `<work>/anr-sdk`, and installs its complete runtime subtree in `<game>/anr/` | Off; no download without explicit opt-in | Use an ANR-enabled builder on Windows x64; requires the release's Microsoft Visual C++ 2015–2022 x64 runtime | Fetch/install only; preserves `nr_fg.ini` and modified packages | Does not enable frame generation, run installers, or support native Linux/ARM64 | Full builder-to-game launch and real provider execution | Off, Auto and Built-in do not load ANR. The source documents starting with fixed 2x and a temporal upscaler; actual supported counts and output still need validation against the real provider. The game's base FPS remains separate from generated frames. ## Measurements main: d9648863ab786fd81cb632a65b13ab697b6ee004 (2026-11-13) this PR: feat/longshot-anr-framegen @ 073d4836c3d7f617507b960ee04a421150f14dc8 Companion Launcher PR: [LongshotLauncher PR #50](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/50). | Verification | main @ d9648863 | this PR @ 073d4836 | |---|---|---| | Real ANR provider initialization and generated output | Not measured | Pending the current local smoke | | Same-scene base/generated FPS and frame time | Not measured | Not measured | | Full build and game-free suite on these commits | No paired run recorded | Pending | The branch has been rebased onto the named main. The existing renderer checks at 0a8504b and downloader checks at ee004cf below are historical preparation, not validation or performance measurements of the rebased head. No generated-frame output or FPS improvement is claimed. Local Launcher/game validation is now being prepared; keep this experimental PR in draft until it is complete. ## Testing **Tested:** 14 targeted renderer checks, strict Windows syntax compilation of `vk_anr.cpp`, source/diff checks, and the original cross-ABI fixture at `0a8504b`. At `ee004cf`, 22 downloader tests and the 40 adjacent FFX/NGX/make_game tests passed. A real official ZIP was downloaded, verified and installed into a disposable fake-game directory; a second fetch proved cache reuse without network. No DLL or installer was executed. The fixture exercises numeric and resource-pointer arguments, Reset, unsigned 64-bit precision, null/missing values and invalid numeric conversions. The Vulkan resource layout was checked against the public ABI. **Not tested:** full application build including the opt-in download, full game-free suite on the rebased head, Linux compilation/runtime, real ANR Populate/Init/Create/Evaluate/Shutdown, generated output on the RX 5500 XT, live engine switching, resize/DRS/cuts under the real provider, HDR behavior, quality/ghosting, resource usage, performance or default-state cost in the game. Native Linux currently has an unavailable-provider path; it has not been compiled in this validation. **Needs other testers:** - Real-provider Windows Vulkan testing, initially RX 5500 XT: initialize ANR and prove fixed-2x output, effective maker reporting, input correctness, resize/cut recovery and resource cleanup. Local execution is pending; request to open after the first local smoke, while this remains WIP. - Linux build check: compile the unavailable-provider path and verify normal frame generation remains intact; request to open while this remains WIP. ## Screenshots Pending a real in-game run. No mocked menu or synthetic frame is presented as ANR output. ## Risk and rollback The closed provider's Vulkan contract, resource lifetime and output have not yet been validated in the game. Incorrect depth/motion/color inputs may produce artifacts even if evaluation succeeds. Select Auto or Built-in, or remove the optional external package, to return to the normal generator. The downloader leaves manual/modified packages untouched and preserves `nr_fg.ini`; deployment failure rolls the old package back and retains its backup if rollback itself fails. Existing defaults and NVIDIA capability gates remain intact. ## Reviewer notes Start with the selection/lifecycle gates, `vk_anr.cpp`, the owned temporal inputs and the original parameter-ABI fixture. The addon remains external: its binary/model redistribution terms have not been established. The ABI mock proves the cross-compiler callback boundary, not compatibility or performance of the actual ANR DLL. This is intentionally a draft/WIP and must not be marked ready until the missing build and real-provider validation are complete. ## Issues Player-requested optional ANR integration. No issue is closed by this draft. ## Checklist ### For everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`). - [x] Rebased on current `main`. — Head 073d4836 contains main d9648863; current-head validation remains pending. - [ ] `python -I -B tests/run_all.py` run and passing (any failure that also fails on `main` is named above). — Targeted checks only so far. - [ ] Tested in the game, or what wasn't is named under Testing. — Real-provider execution remains pending. - [x] Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests). — Requests to open are explicitly identified while WIP. - [ ] Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. — No game measurements yet. - [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. — Original adapter/tests using public interface facts; no ANR binary, model or implementation included. ### If applicable - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Flags noted, and the switch reference updated (docs/development.md, the README). - [ ] Screenshots for a change that shows on screen. — Pending the game run. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. — Windows fixtures/syntax pass; full builds and Linux are pending. - [x] Docs updated.
Author
First-time contributor

Added the opt-in official ANR runtime downloader and verified-deployment event in ee004cf. The companion Launcher change will expose it only for supported builders. The 22 ANR tests, 40 adjacent builder checks and an isolated real-addon/cache smoke passed; the full build and actual provider/GPU validation remain pending, so this stays WIP.

Added the opt-in official ANR runtime downloader and verified-deployment event in ee004cf. The companion Launcher change will expose it only for supported builders. The 22 ANR tests, 40 adjacent builder checks and an isolated real-addon/cache smoke passed; the full build and actual provider/GPU validation remain pending, so this stays WIP.
brunobaccari force-pushed feat/longshot-anr-framegen from ee004cfaf0
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
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
to 073d4836c3
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
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
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-13 18:38:30 +00:00
Compare
brunobaccari changed title from WIP: feat(vk): add an optional ANR frame generation provider to feat(vk): add an optional ANR frame generation provider 2026-11-13 18:38:37 +00:00
brunobaccari changed title from feat(vk): add an optional ANR frame generation provider to WIP: feat(vk): add an optional ANR frame generation provider 2026-11-13 18:55:01 +00:00
brunobaccari changed title from WIP: feat(vk): add an optional ANR frame generation provider to feat(vk): add an optional ANR frame generation provider 2026-11-13 19:10:50 +00:00
brunobaccari force-pushed feat/longshot-anr-framegen from 073d4836c3
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
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
Website / Website on Cloudflare (pull_request) Has been cancelled
to b998c8feb1
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
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
2026-11-13 19:10:52 +00:00
Compare
brunobaccari changed title from feat(vk): add an optional ANR frame generation provider to WIP: feat(vk): add an optional ANR frame generation provider 2026-11-13 19:36:39 +00:00
First-time contributor

May I ask is there HUD ghosting issue with ANR framegen?

May I ask is there HUD ghosting issue with ANR framegen?
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
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
This pull request has changes conflicting with the target branch.
  • gpu/vk/vk_framegen.cpp
  • nx2/make_game.py
  • tests/present_source_crop_test.cpp
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/longshot-anr-framegen:brunobaccari-feat/longshot-anr-framegen'
git switch 'brunobaccari-feat/longshot-anr-framegen'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!244
No description provided.