FSR 3 frame generation: a generation rectangle for letterbox bars (VICTORY_FG_RECT, VICTORY_FG_BARS_CLEAR; off by default) #1615

Manually merged
github merged 2 commits from github-bot/gh-1615 into main 2026-11-29 08:22:00 +00:00 AGit
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-28 22:23 UTC · original
Jesper-Andersson:pr/fg-rect → main · +703 −2 · 3 files · 2 commits · merged 2026-11-29 08:16 UTC

Relates to #387

What it changes

FSR 3 frame generation always works on the whole back buffer. FidelityFX's generationRect is "the area of the backbuffer that should be used for frame generation in case only a part of the screen is active (e.g. due to movie bars)" (ffx_framegeneration.h), and VIctory always passes the full size. In letterboxed cutscenes the bars hold zero motion and one depth value per row, so the interpolation runs over rows that carry nothing. #387 reports a torn line at about 94 % of the picture's height, where the letterbox ends. This PR gives that rectangle a switch and adds the diagnostics needed to look into #387. It does not claim to fix the torn line, hence "Relates to".

New module crates/victory-gpu/src/streamline/fg_rect.rs (with unit tests), hooked into streamline/fsr.rs. All of it is off by default: unset, the rectangle stays the whole back buffer, as before.

  • VICTORY_FG_RECT=<top>,<bottom> sets a fixed full-width rectangle, in pixels or in percent of the display height (140,940, 12%,88%).
  • VICTORY_FG_RECT=auto looks for bands at the top and bottom where the motion vectors are all zero and the depth is one value per row. It checks a copy of both textures read back two presents later. The rectangle follows only after 8 presents agree (within 2 rows), and it goes back to the whole back buffer at a camera reset. Only the outer 30 % of rows at each edge is scanned.
  • VICTORY_FG_BARS_CLEAR=1 (only with a rectangle, manual or auto) clears motion vectors to zero and depth to far in the rows outside the rectangle before the prepare dispatch. The read-back copy is taken before the clear.
  • Depth formats: 32-bit (D32_FLOAT, R32_TYPELESS, R32_FLOAT), 16-bit (D16_UNORM, R16_TYPELESS, R16_UNORM) and the 32-bit formats with a stencil plane (R32G8X24_TYPELESS, which is format 19, D32_FLOAT_S8X24_UINT and R32_FLOAT_X8X24_TYPELESS). The texel size comes from the copy footprint, and only the depth's first four bytes are compared. An unsupported format turns the search off with a log line that names it.
  • Diagnostics, always on with FSR 3 frame generation: the "first frame prepared" line now also logs the depth and motion vector texture sizes and the generation rectangle. A change of the rectangle is logged.

The rectangle is part of each present's configuration, so a change does not recreate any context. Nothing is written to disk: the read-backs stay in memory.

How it was tested

  • GPU and profile: RTX 2070 SUPER 8 GB, Windows 11, Series S, 1080p output, DLSS Performance, FSR 3 frame generation 2x, no ray tracing.
  • Before: the rectangle is always the full back buffer, and the log does not show the depth and motion vector sizes.
  • After: unit tests cover parsing the switch (pixels, percent, auto, bad input), finding bands in synthetic rows, the 8-present agreement and the reset. A release build (cargo build --locked --release -p victory) passes. Not yet confirmed in game: auto mode in cutscenes (whether it finds the letterbox and how the torn line from #387 looks with and without VICTORY_FG_BARS_CLEAR). This PR stays a draft until that check is done.
  • For shader changes, the wave sizes tested: N/A (no translator changes).
  • cargo test passed for the crates it touches: yes (victory-gpu: 559 passed, 43 ignored)
  • cargo clippy --no-deps -p victory-gpu: no new warnings. With -D warnings, clippy stops only on lints that are already on main (victory-gpu host.rs, host/send.rs, pool.rs, resource.rs, streamline.rs, streamline/fsr.rs; victory-shader emit/lower.rs). The warning set is the same as on main (the open #1527 fixes them).
  • cargo xtask policy: fails on upstream main's own crates/victory-shader/src/emit/lower.rs (667,523 bytes, over the 640 KiB limit; #1429; the open #1493 and #1527 fix it). Nothing this PR adds trips it, and the pre-commit asset check passed for every file it changes.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1509, #1527, #1132, #1513, #1518, #1357, #1236, #1106
    • #1509 (FSR display presents through Streamline, draft) edits streamline/fsr.rs around the present. No logic overlap: this PR only changes generation_rect, one Live field and the prepare log fields. It may need a trivial rebase.
    • #1527 (CI: clippy and file size green) touches streamline/fsr.rs for lints. Small textual overlap at most.
    • #1132 (Alt+Enter on the FSR 3 swap chain) touches fsr.rs in swap chain creation, not the code this PR touches.
    • #1513 / #1518 (movie gate) decide whether frame generation runs during movies. This PR changes what area it works on when it does run, so they are independent. #669 (closed) brought in the movie gate.
    • #1357 (pace guard), #1236 (FSR on AMD) and #1106 (FSR 4 frame generation on AMD) also edit fsr.rs. Different functions.

This was written with AI assistance (Claude Code).

**@⁠Jesper-Andersson** on GitHub · 2026-11-28 22:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1615) `Jesper-Andersson:pr/fg-rect` → `main` · +703 −2 · 3 files · 2 commits · merged 2026-11-29 08:16 UTC <!-- Labels: pr-feature, pr-diagnostics, frame-generation, cutscene (in the title, as the template asks). --> Relates to #387 ## What it changes FSR 3 frame generation always works on the whole back buffer. FidelityFX's `generationRect` is "the area of the backbuffer that should be used for frame generation in case only a part of the screen is active (e.g. due to movie bars)" (`ffx_framegeneration.h`), and VIctory always passes the full size. In letterboxed cutscenes the bars hold zero motion and one depth value per row, so the interpolation runs over rows that carry nothing. #387 reports a torn line at about 94 % of the picture's height, where the letterbox ends. This PR gives that rectangle a switch and adds the diagnostics needed to look into #387. It does not claim to fix the torn line, hence "Relates to". New module `crates/victory-gpu/src/streamline/fg_rect.rs` (with unit tests), hooked into `streamline/fsr.rs`. All of it is off by default: unset, the rectangle stays the whole back buffer, as before. - `VICTORY_FG_RECT=<top>,<bottom>` sets a fixed full-width rectangle, in pixels or in percent of the display height (`140,940`, `12%,88%`). - `VICTORY_FG_RECT=auto` looks for bands at the top and bottom where the motion vectors are all zero and the depth is one value per row. It checks a copy of both textures read back two presents later. The rectangle follows only after 8 presents agree (within 2 rows), and it goes back to the whole back buffer at a camera reset. Only the outer 30 % of rows at each edge is scanned. - `VICTORY_FG_BARS_CLEAR=1` (only with a rectangle, manual or auto) clears motion vectors to zero and depth to far in the rows outside the rectangle before the prepare dispatch. The read-back copy is taken before the clear. - Depth formats: 32-bit (D32_FLOAT, R32_TYPELESS, R32_FLOAT), 16-bit (D16_UNORM, R16_TYPELESS, R16_UNORM) and the 32-bit formats with a stencil plane (R32G8X24_TYPELESS, which is format 19, D32_FLOAT_S8X24_UINT and R32_FLOAT_X8X24_TYPELESS). The texel size comes from the copy footprint, and only the depth's first four bytes are compared. An unsupported format turns the search off with a log line that names it. - Diagnostics, always on with FSR 3 frame generation: the "first frame prepared" line now also logs the depth and motion vector texture sizes and the generation rectangle. A change of the rectangle is logged. The rectangle is part of each present's configuration, so a change does not recreate any context. Nothing is written to disk: the read-backs stay in memory. ## How it was tested - GPU and profile: RTX 2070 SUPER 8 GB, Windows 11, Series S, 1080p output, DLSS Performance, FSR 3 frame generation 2x, no ray tracing. - Before: the rectangle is always the full back buffer, and the log does not show the depth and motion vector sizes. - After: unit tests cover parsing the switch (pixels, percent, `auto`, bad input), finding bands in synthetic rows, the 8-present agreement and the reset. A release build (`cargo build --locked --release -p victory`) passes. **Not yet confirmed in game:** auto mode in cutscenes (whether it finds the letterbox and how the torn line from #387 looks with and without `VICTORY_FG_BARS_CLEAR`). This PR stays a draft until that check is done. - For shader changes, the wave sizes tested: N/A (no translator changes). - `cargo test` passed for the crates it touches: yes (victory-gpu: 559 passed, 43 ignored) - `cargo clippy --no-deps -p victory-gpu`: no new warnings. With `-D warnings`, clippy stops only on lints that are already on main (victory-gpu `host.rs`, `host/send.rs`, `pool.rs`, `resource.rs`, `streamline.rs`, `streamline/fsr.rs`; victory-shader `emit/lower.rs`). The warning set is the same as on main (the open #1527 fixes them). - `cargo xtask policy`: fails on upstream main's own `crates/victory-shader/src/emit/lower.rs` (667,523 bytes, over the 640 KiB limit; #1429; the open #1493 and #1527 fix it). Nothing this PR adds trips it, and the pre-commit asset check passed for every file it changes. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1509, #1527, #1132, #1513, #1518, #1357, #1236, #1106 - #1509 (FSR display presents through Streamline, draft) edits `streamline/fsr.rs` around the present. No logic overlap: this PR only changes `generation_rect`, one `Live` field and the prepare log fields. It may need a trivial rebase. - #1527 (CI: clippy and file size green) touches `streamline/fsr.rs` for lints. Small textual overlap at most. - #1132 (Alt+Enter on the FSR 3 swap chain) touches `fsr.rs` in swap chain creation, not the code this PR touches. - #1513 / #1518 (movie gate) decide whether frame generation runs during movies. This PR changes what area it works on when it does run, so they are independent. #669 (closed) brought in the movie gate. - #1357 (pace guard), #1236 (FSR on AMD) and #1106 (FSR 4 frame generation on AMD) also edit `fsr.rs`. Different functions. This was written with AI assistance (Claude Code).
All off by default (the rectangle stays the whole back buffer).
- The "first frame prepared" line now logs the depth and motion vector
  texture sizes and the generation rectangle; a change of the rectangle is logged.
- VICTORY_FG_RECT=<top>,<bottom> (pixels or percent): manual rectangle.
- VICTORY_FG_RECT=auto: bands of zero motion and one depth value per row at
  the top and bottom, found in a read-back copy two presents old; follows
  after 8 consistent presents, back to full at a camera reset.
- VICTORY_FG_BARS_CLEAR=1: motion vectors zero and depth far in the rows
  outside the rectangle before the prepare dispatch.
Refs trustno1-coder/VIctory-NVIDIA#387.

This change was made with AI assistance (Claude Code).
The depth plane's texel size is taken from the copy footprint (4 or 8
bytes); only the first four bytes are compared. The depth clear takes the
same formats. Not built or run.

This change was made with AI assistance (Claude Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 22:24:39 +00:00
github manually merged commit 5fb3564a2e into main 2026-11-29 08:22:00 +00:00
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!1615
No description provided.