GPU: opt-in per-present drain on stage 3 (VICTORY_PRESENT_DRAIN=1) #3978

Open
github-bot wants to merge 1 commit from github-bot/gh-3978 into main AGit
Owner

@⁠bemfavivaEC807E52 on GitHub · 2026-11-30 13:32 UTC · original
bemfavivaEC807E52:pr/present-drain → main · +56 −7 · 2 files · 1 commits · open

Summary

Adds a minimal, opt-in VICTORY_PRESENT_DRAIN=1 switch (off by default) as a stage-3 workaround for #2185 (1-frame stretched/broken polygons under cross-frame overlap on v2026.11.29.01–v2026.11.29.05).

What it changes

  • crates/victory-gpu/src/host.rs: Adds present_drain() (OnceLock<bool>, opt-in VICTORY_PRESENT_DRAIN=1 under stage-3 late_free_present(); logs once at INFO when active and warns once if requested outside stage 3). In Host::present_placed, forces slot = None when active so each displayed present takes the existing synchronous self.execute(&[copy]) path (the same path screenshots already use), settling flights once per frame while leaving stage 3, queue::behind, thin translation, VICTORY_LATE_WAIT_LISTS=256, and DLSS/FSR frame generation active.
  • crates/victory-gpu/src/queue/behind.rs: Under VICTORY_PRESENT_DRAIN=1, defaults VICTORY_SUBMIT_FRAMES to 0 for conservative safety while still honoring explicit overrides (e.g. VICTORY_SUBMIT_FRAMES=1).
  • Tests: Adds unit tests for present_drain_for and present_backlog covering defaults and explicit overrides.

Why this helps (#2185)

  • VICTORY_LATE_WAIT=2 stops the artifacts but disables DLSS/FSR frame generation (behind::started() requires stage 3).
  • VICTORY_LATE_WAIT_LISTS=1 keeps FG alive but settles ~16–17 times per frame (18.2 fps on RTX 4090).
  • Draining once at each displayed present lets all ~17 within-frame flights overlap freely (1.0 settle/frame) and keeps 4x DLSS FG alive.

Verification (RTX 4090, 9850X3D, 4K, Series X, DLSS Ultra Performance Preset L, 4x MFG, RT off)

  • cargo test -p victory-gpu --locked present_drain: 2 passed, 0 failed.
  • VICTORY_PRESENT_DRAIN=1 (default frames=0): 0 stretched polygons, 1.0 settle/frame, 4x FG active (23/24 -> 92/96, presented=4), ~21.6–24.3 fps (41.1 ms median).
  • VICTORY_PRESENT_DRAIN=1 + VICTORY_SUBMIT_FRAMES=1: 0 stretched polygons over ~6 min / 6,913 DLSS frames, 0 errors, 4x FG active (24 -> 96 heavy indoor, up to 29 -> 116 at 33.0 ms median in lighter sections).
  • Default (VICTORY_PRESENT_DRAIN unset or 0): zero behavior change.
**@⁠bemfavivaEC807E52** on GitHub · 2026-11-30 13:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3978) `bemfavivaEC807E52:pr/present-drain` → `main` · +56 −7 · 2 files · 1 commits · open ## Summary Adds a minimal, opt-in `VICTORY_PRESENT_DRAIN=1` switch (off by default) as a stage-3 workaround for #2185 (1-frame stretched/broken polygons under cross-frame overlap on `v2026.11.29.01`–`v2026.11.29.05`). ### What it changes - **`crates/victory-gpu/src/host.rs`**: Adds `present_drain()` (`OnceLock<bool>`, opt-in `VICTORY_PRESENT_DRAIN=1` under stage-3 `late_free_present()`; logs once at INFO when active and warns once if requested outside stage 3). In `Host::present_placed`, forces `slot = None` when active so each displayed present takes the existing synchronous `self.execute(&[copy])` path (the same path screenshots already use), settling flights once per frame while leaving stage 3, `queue::behind`, thin translation, `VICTORY_LATE_WAIT_LISTS=256`, and DLSS/FSR frame generation active. - **`crates/victory-gpu/src/queue/behind.rs`**: Under `VICTORY_PRESENT_DRAIN=1`, defaults `VICTORY_SUBMIT_FRAMES` to `0` for conservative safety while still honoring explicit overrides (e.g. `VICTORY_SUBMIT_FRAMES=1`). - **Tests**: Adds unit tests for `present_drain_for` and `present_backlog` covering defaults and explicit overrides. ### Why this helps (#2185) - `VICTORY_LATE_WAIT=2` stops the artifacts but disables DLSS/FSR frame generation (`behind::started()` requires stage 3). - `VICTORY_LATE_WAIT_LISTS=1` keeps FG alive but settles ~16–17 times per frame (18.2 fps on RTX 4090). - Draining once at each displayed present lets all ~17 within-frame flights overlap freely (`1.0` settle/frame) and keeps 4x DLSS FG alive. ### Verification (RTX 4090, 9850X3D, 4K, Series X, DLSS Ultra Performance Preset L, 4x MFG, RT off) - `cargo test -p victory-gpu --locked present_drain`: 2 passed, 0 failed. - `VICTORY_PRESENT_DRAIN=1` (default `frames=0`): 0 stretched polygons, 1.0 settle/frame, 4x FG active (`23/24 -> 92/96`, `presented=4`), ~21.6–24.3 fps (41.1 ms median). - `VICTORY_PRESENT_DRAIN=1` + `VICTORY_SUBMIT_FRAMES=1`: 0 stretched polygons over ~6 min / 6,913 DLSS frames, 0 errors, 4x FG active (`24 -> 96` heavy indoor, up to `29 -> 116` at 33.0 ms median in lighter sections). - Default (`VICTORY_PRESENT_DRAIN` unset or `0`): zero behavior change.
Add an opt-in VICTORY_PRESENT_DRAIN=1 switch (off by default) that keeps stage-3 late waits, the submission worker, thin translation, and DLSS/FSR frame generation active while settling flights once at each displayed present through the existing synchronous copy path (slot = None in Host::present_placed).

When VICTORY_PRESENT_DRAIN=1 is set:
- VICTORY_SUBMIT_FRAMES defaults to 0 for safety, while still honoring an explicit value (e.g. VICTORY_SUBMIT_FRAMES=1).
- Outside stage 3, a one-time warning is logged and the switch stays off.

Verified on RTX 4090 / 4K / Series X / 4x DLSS FG (#2185): eliminates the 1-frame stretched polygon regression with 1.0 settle/frame while keeping 4x FG active, whereas VICTORY_LATE_WAIT=2 disables FG and VICTORY_LATE_WAIT_LISTS=1 settles ~17 times per frame.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 13:34:56 +00:00
github-bot force-pushed github-bot/gh-3978 from 019f18d879 to 61adeee44d 2026-11-30 16:52:22 +00:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3978/head:github-bot/gh-3978'
git switch 'github-bot/gh-3978'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3978'
git switch 'github-bot/gh-3978'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3978'
git switch 'github-bot/gh-3978'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3978'
git switch 'main'
git merge --squash 'github-bot/gh-3978'
git switch 'main'
git merge --ff-only 'github-bot/gh-3978'
git switch 'main'
git merge 'github-bot/gh-3978'
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!3978
No description provided.