Frame generation asks the base-frame pace guard before it runs #1357

Open
github-bot wants to merge 7 commits from github-bot/gh-1357 into main AGit
Owner

@⁠HailLucifer666 on GitHub · 2026-11-28 17:57 UTC · original
HailLucifer666:port/fg-base-pace-guard → main · +3230 −24 · 21 files · 7 commits · open

Frame generation is a presentation multiplier on a base that already runs. On a base whose median frame is past 50 ms (under 20 fps) generated frames halve an already-too-slow one, triple input staleness, and spend card memory the run needs — #775 ("low base FPS causing slomo effect") and #788's full-card state are this class. The design (thresholds, hysteresis, the state matrix, the false-positive controls) is docs/plan-victory-nvidia-fg-guard.md on the Marvisak line; this PR lands its decision core.

The mechanism (crates/victory-gpu/src/streamline/pace.rs):

  • A 30-present ring of base-frame intervals; the decision is the median, never the mean — the same run whose fps average read 7.76 while its median read 2.44 (docs/findings.md) is why, and a mean would refuse on one long loading frame inside a healthy run.
  • Refuse past 50 ms, resume at or under 33_333 µs (30 fps), hold between — hysteresis, so a base hovering in the band does not flap frame generation per frame.
  • Permissive until ten intervals exist: no refusal on startup noise.
  • VICTORY_FRAMEGEN_FORCE=1 is the documented escape: it answers yes always and still observes, so releasing it leaves a correct median behind rather than an empty ring.
  • Wired as one more arm of before_present's configuration: it can only say no — every other switch-off arm (no fresh upscaling, size or format change, focus, the submission line) is theirs, untouched. That is the false-positive control: the guard never forces anything on, and the first refusal while the menu wants frame generation is logged once.

Tests and probes (streamline::pace::tests, 7 tests): the unmeasurable ring permits; 60 ms medians refuse; 20 ms medians permit through the ring wrap; the hysteresis band holds and recovers; force overrides and still observes; median-not-mean (ten 100 ms frames among twenty 10 ms ones leave the median fast); non-monotonic stamps feed nothing. Two mutation probes ran red and were restored, recorded in the test file: the median replaced by a mean; the hysteresis band removed.

Scope: FSR 3 / Streamline frame generation only — the DLSS-side configuration and the MFG unlocker path are theirs. The guard says nothing about which multiplier: that is the driver's and the menu's. The behavior claim that stays unproven until a title run (no machine here runs it): that the base-pace thresholds are right for real scenes — they are the design doc's, changeable by env-reviewed constants, and the escape switch is one variable.

Stacks on #1290 → #1294 → #1326 → #1328 → #1348 for CI. Locally: victory-gpu pace tests 7/7, both clippy -D warnings variants clean (including --all-features — my first draft of the wiring carried its own let_and_return, which is the exact lint class #1290 fixes; caught before any push).

**@⁠HailLucifer666** on GitHub · 2026-11-28 17:57 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1357) `HailLucifer666:port/fg-base-pace-guard` → `main` · +3230 −24 · 21 files · 7 commits · open Frame generation is a presentation multiplier on a base that already runs. On a base whose median frame is past 50 ms (under 20 fps) generated frames halve an already-too-slow one, triple input staleness, and spend card memory the run needs — #775 ("low base FPS causing slomo effect") and #788's full-card state are this class. The design (thresholds, hysteresis, the state matrix, the false-positive controls) is `docs/plan-victory-nvidia-fg-guard.md` on the Marvisak line; this PR lands its decision core. **The mechanism** (`crates/victory-gpu/src/streamline/pace.rs`): - A 30-present ring of base-frame intervals; the decision is the **median**, never the mean — the same run whose fps average read 7.76 while its median read 2.44 (`docs/findings.md`) is why, and a mean would refuse on one long loading frame inside a healthy run. - Refuse past **50 ms**, resume at or under **33_333 µs** (30 fps), **hold between** — hysteresis, so a base hovering in the band does not flap frame generation per frame. - Permissive until ten intervals exist: no refusal on startup noise. - **`VICTORY_FRAMEGEN_FORCE=1`** is the documented escape: it answers yes always and **still observes**, so releasing it leaves a correct median behind rather than an empty ring. - Wired as one more arm of `before_present`'s configuration: it **can only say no** — every other switch-off arm (no fresh upscaling, size or format change, focus, the submission line) is theirs, untouched. That is the false-positive control: the guard never forces anything on, and the first refusal while the menu wants frame generation is logged once. **Tests and probes** (`streamline::pace::tests`, 7 tests): the unmeasurable ring permits; 60 ms medians refuse; 20 ms medians permit through the ring wrap; the hysteresis band holds and recovers; force overrides and still observes; **median-not-mean** (ten 100 ms frames among twenty 10 ms ones leave the median fast); non-monotonic stamps feed nothing. **Two mutation probes ran red and were restored, recorded in the test file**: the median replaced by a mean; the hysteresis band removed. **Scope**: FSR 3 / Streamline frame generation only — the DLSS-side configuration and the MFG unlocker path are theirs. The guard says nothing about which multiplier: that is the driver's and the menu's. The behavior claim that stays unproven until a title run (no machine here runs it): that the base-pace thresholds are right for real scenes — they are the design doc's, changeable by env-reviewed constants, and the escape switch is one variable. Stacks on #1290 → #1294 → #1326 → #1328 → #1348 for CI. Locally: victory-gpu pace tests 7/7, both clippy `-D warnings` variants clean (including `--all-features` — my first draft of the wiring carried its own `let_and_return`, which is the exact lint class #1290 fixes; caught before any push).
THE BUG. Main failed four CI pushes in a row (runs 46154038190, 46154833762,
46155565404, 46157117122). The build died on clippy -D warnings before any test
ran: let_and_return (emit/mod.rs:2756), manual_is_multiple_of
(shadow.rs:1708), some_filter (gameinput.rs:1383) and -- only under
--all-features, which is why fewer showed at first -- manual_is_multiple_of
(descriptor.rs:1234). Separately, repository_passes_policy has been failing
since 4715a42 committed bindings.ini without an allowlist entry; it could not
be seen for the same reason.

THE FIX. Each lint's suggested form; is_multiple_of twice, the let binding
returned directly, the scripted-key filter written as the condition first (vk
is a plain local, so the evaluation-order note is immaterial). And the ini
extension joins the allowlist for bindings.ini, with a comment naming the
commit that needs it -- veto and remove if the file should live outside the
repo instead.

SCOPE. Nothing else; these are the minimum to make main's CI able to reach the
tests again.
THE BUG. Three classes, all found on main today: (1) the GPU tests silently
report as passed on any machine without a WARP adapter -- WarpHarness::new()
returns an Option and every acquire site does `let Some(...) = ... else
{ return }` (indirect.rs around 894, 970, 1025 and more), so the suite's green
says nothing about whether the GPU tests executed; (2) cargo reports a filter
that matched no test as exit 0, so a narrowed command reads as a pass; (3) a
workflow file GitHub cannot load produces no run at all, and nothing in CI
reads ci.yml itself before GitHub does. The pre-commit hook was also committed
100644, which makes every POSIX clone skip it in silence (found with
git ls-tree; the same defect the Marvisak line shipped and fixed).

THE FIX. Port the checks our Marvisak PR #2854 lineage shipped there: `cargo
xtask test-gate` counts what each test binary announced (running N tests)
against what it reported (test result: ...), refuses a run that executed
nothing, refuses reports it cannot attribute to a binary cargo named, and
parses CI's colored output; `cargo xtask workflows` shape-checks every file
under .github/workflows, including duplicate keys (yaml-rust2 keeps the later
value; GitHub refuses the document outright) and typechanged entries; policy
--staged now fails closed on a staged entry the index cannot serve (a gitlink,
an unspellable name) instead of skipping it; the hook runs both checks and its
skip message names both; the hook is committed 100755; CI builds first and runs
the gated binaries after, so a red run cannot hide behind a compile.

WHY NOT HYPOTHETICAL. Main is red right now (issue #1267) precisely because the
suite's own account was unreadable; on our Marvisak twin the same tooling
refused a green-but-empty run in CI and caught a lost hook mode a green run
missed.

SCOPE. The WARP skip is made loud in a follow-up, not here: turning skips into
panics before we know whether CI's runner has a WARP adapter could turn CI red
on machines that were honestly skipping. The first CI run of this PR answers
that question. The gate parses cargo's output shapes as they exist today; a
--format json run is refused rather than guessed at.

PROVENANCE. Ported from our Marvisak/VIctory PR #2854 branch (staging-bounds
and pipeline-library fixes from the same line landed upstream as #1658/#1660);
carries that branch's second-review fixes: policy --staged fails closed like
its sibling, duplicate keys are refused, typechanged staged entries are listed,
and the hook's skip message names both checks.
THE BUG. FSR 3 frame generation was made ready whenever a DLSS mode other than
off was chosen. DLAA is such a mode and does no upscaling, so the title stayed
on its own FidelityFX upscaler with AMD's frame-generation files prepared
beside it, and the game stopped at victory-image+0x2219650 -- the break the
DLSS-off case was gated for (#331, #459) and which #663 showed still reachable
through DLAA.

WHY NOT HYPOTHETICAL. The new test (fsr_framegen_is_not_prepared_for_dlaa) ran
against the unfixed gate and FAILED with VICTORY_FSR_FRAMEGEN=1 set under dlaa;
the same revert is the mutation probe. The gate's first draft also dropped the
streamline-present condition and without_nvidias_files_there_is_no_dlss caught
it before any push.

THE FIX. The gate requires the conjunction: DLSS asked, a Streamline folder
present, and a mode that actually upscales (quality, balanced, performance).
DLAA itself still runs exactly as before.

SCOPE. The launcher only; the layer's own guards (fsr.rs) are untouched.
THE BUG. On an RTX 50 card this script set FrameGenX=4 whenever the GPU name
matched, before ever looking at what the F1 menu had saved. A menu set to 2x
loaded the game at 4x (#966): two sources of one value, and the script won --
while the exe's own launcher (play.rs) honours the menu, so the two launchers
disagreed.

THE FIX. Precedence, now written down and matching the exe: GTA6_FRAMEGEN_X >
the F1 menu's saved VICTORY_MENU_FRAMEGEN (read from both known
victory-settings.txt locations, LOCALAPPDATA first -- the file the in-game menu
writes) > the RTX-50 auto-4x > 2x. A menu setting of 0 (ready, off) is passed
through instead of being overridden. The stale mode header ("2x", modes 1-4)
now matches the script's actual behavior (modes 1-6, multiplier per the
precedence).

WHY NOT HYPOTHETICAL. #966's reporter: menu and victory-settings.txt at 2x,
game at 4x, on an RTX 5080 -- exactly this branch of the script.

SCOPE. Script only; no test harness exists for the PowerShell launchers, so the
verification is a parse check plus reading -- the exe-side precedence is
already pinned by play.rs's tests. The repo-root vs LOCALAPPDATA menu-file
drift between the two launchers remains (documented in the repo audit);
reconciling it is the launcher-unification PR this repo's queue already wants.
THE BUG. The census counted placed textures the title fills whose title
memory is not mapped any more (resource.rs, the 10-bucket count and census():
"the bytes of those whose title memory is not mapped any more") and nothing
acted on it. Such a copy's source is gone -- it can never be refreshed from
title memory -- so past its last use it is pure VRAM waste on cards the
reports show filling up (#453: graphics memory full within a minute; #609:
3,072 MB kept for render targets never given back).

WHY NOT HYPOTHETICAL. The state is the census's own measured bucket
(count[8], sampled every 16th because asking Windows about all of them takes
too long), with issue numbers behind the waste.

THE FIX. title_memory_unmapping records the range in O(1)
(resource::unmapped); title_memory_remapped clears ranges it covers; the
sweep drains the record and, for a placed texture overlapping it, applies the
census's own idle window for that state (30 s, 60 frames --
UNMAPPED_IDLE_MS/UNMAPPED_IDLE_FRAMES, one constant now shared by the
census's count and the sweep's gate) instead of the VRAM-pressure line,
which can be minutes. Everything else is the sweep's own gate, unchanged: no
list, no slot, the host copy held alone. The walk is the sweep's, never the
unmapping thread's: our first form of this on Marvisak/VIctory (#432) walked
per-unmap and cost 975 ms of every second of a load.

SCOPE. host_wrote textures keep the sweep's existing skip (conservative:
fewer evictions, never more). The budget (`most`) still bounds bytes per
sweep; unmapped copies compete with idle ones under it and continue over
successive looks. Tests: the overlap arithmetic (half-open, zero-length,
top-of-space saturation), the bounded record, and the gate's two arms, with
mutation probes recorded in the test file (the unmapped arm disabled, the
overlap boundary flipped -- each watched red, then restored).
THE BUG. Frame generation ran whenever it was asked, with no look at the
base frame it multiplies: on a base whose median is past 50 ms (under 20
fps) generated frames halve an already-too-slow one, triple input staleness,
and spend card memory the run needs (#775, #446's 12-14 fps base). The
design is docs/plan-victory-nvidia-fg-guard.md (the Marvisak line's tree).

THE FIX. streamline/pace.rs: a 30-present ring of base-frame intervals;
the decision is the MEDIAN of the ring (a mean refuses on one long loading
frame inside a healthy run -- the same run whose fps average read 7.76
while its median read 2.44); refuse past 50 ms, resume at or under 30 fps,
and hold between (hysteresis, so a base hovering in the band does not flap
frame generation per frame); permissive until ten intervals exist (no
refusal on startup noise); VICTORY_FRAMEGEN_FORCE=1 is the documented
escape, answers yes always and still observes. The guard is wired as one
more arm of before_present's configuration: it can only say no -- every
other switch-off arm is theirs, untouched, and the first refusal while the
menu wants frame generation is logged once.

WHY NOT HYPOTHETICAL. Seven tests pin the ring, both thresholds, the
hysteresis band, the force escape, median-not-mean, and the
non-monotonic-stamp case; two mutation probes ran red and were restored
(the median replaced by a mean; the hysteresis band removed) -- recorded in
the test file. The device-free core is the whole decision; the present
path only stamps the time.

SCOPE. FSR 3 / Streamline frame generation only; the DLSS-side
configuration and the MFG unlocker path are theirs. The guard says nothing
about which multiplier -- that is the driver's and the menu's.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 17:57:21 +00:00
github-bot force-pushed github-bot/gh-1357 from d41deda763 to 2fc2de2b25 2026-11-29 00:21:50 +00:00 Compare
This pull request has changes conflicting with the target branch.
  • Cargo.lock
  • apps/victory/src/play.rs
  • crates/victory-gpu/src/resource.rs
  • crates/victory-gpu/src/streamline/fsr.rs
  • crates/victory-gpu/src/watch.rs
  • crates/victory-hle/src/modules/gameinput.rs
  • scripts/play-gta6-framegen.ps1
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 origin '+refs/pull/1357/head:github-bot/gh-1357'
git switch 'github-bot/gh-1357'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1357'
git switch 'github-bot/gh-1357'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1357'
git switch 'github-bot/gh-1357'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1357'
git switch 'main'
git merge --squash 'github-bot/gh-1357'
git switch 'main'
git merge --ff-only 'github-bot/gh-1357'
git switch 'main'
git merge 'github-bot/gh-1357'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/trustno1-coder--VIctory-NVIDIA!1357
No description provided.