Display output: bars around the picture in a window of other proportions, instead of stretching it #3755

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

@⁠stasadance on GitHub · 2026-11-30 06:03 UTC · original
stasadance:feat/letterbox-output → main · +101 −1 · 3 files · 1 commits · open

Related: #3366

What it changes

When the window's client area isn't at the picture's proportions, the swap chain scales the back buffer to the window, and vkd3d-proton only stretches. Under Wine's X11 driver on GNOME the window manager resizes the window freely (no WM_SIZING, no aspect hints), so the picture came out stretched, e.g. a 1920x1080 window resized to 1328x1080.

Now, when the proportions differ, the back buffer takes the window's size, the composer draws the picture whole in its middle and the rest is black, so the picture is never stretched. DLSS Frame Generation is told the picture's part of the back buffer (kBufferTypeBackbuffer, 53, with its extent alone), so the bars are copied as they are. VICTORY_LETTERBOX=0 stretches, as before.

How it was tested

  • GPU and profile: RTX 4090 on Linux, GNOME Wayland with XWayland (NVIDIA 620.73.04, kron4ek Wine 11.23, vkd3d-proton GE cae8353ed), DLSS + frame generation 2X
  • Before: the window resized to 1328x1080 and the picture was stretched to it.
  • After (run 20261129-225559): "display output: the window's proportions differ from the picture's: bars around it" logged 36 times as the window was resized (back buffers 2560x1443 to 2560x1459 around a 2560x1440 picture), the picture at its own proportions with black bars, and frame generation switched on 7 times in the same run.
  • cargo test passed for the crates it touches: native cargo test cannot build victory-gpu on a Linux host (same on main), so no; cargo xwin clippy for the Windows target adds no warning over current main.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #3366 (stretched in a bordered window), #1615 (FSR 3 FG rectangle for bars, closed), #132.
**@⁠stasadance** on GitHub · 2026-11-30 06:03 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3755) `stasadance:feat/letterbox-output` → `main` · +101 −1 · 3 files · 1 commits · open Related: #3366 ## What it changes When the window's client area isn't at the picture's proportions, the swap chain scales the back buffer to the window, and vkd3d-proton only stretches. Under Wine's X11 driver on GNOME the window manager resizes the window freely (no WM_SIZING, no aspect hints), so the picture came out stretched, e.g. a 1920x1080 window resized to 1328x1080. Now, when the proportions differ, the back buffer takes the window's size, the composer draws the picture whole in its middle and the rest is black, so the picture is never stretched. DLSS Frame Generation is told the picture's part of the back buffer (`kBufferTypeBackbuffer`, 53, with its extent alone), so the bars are copied as they are. `VICTORY_LETTERBOX=0` stretches, as before. ## How it was tested - GPU and profile: RTX 4090 on Linux, GNOME Wayland with XWayland (NVIDIA 620.73.04, kron4ek Wine 11.23, vkd3d-proton GE cae8353ed), DLSS + frame generation 2X - Before: the window resized to 1328x1080 and the picture was stretched to it. - After (run 20261129-225559): "display output: the window's proportions differ from the picture's: bars around it" logged 36 times as the window was resized (back buffers 2560x1443 to 2560x1459 around a 2560x1440 picture), the picture at its own proportions with black bars, and frame generation switched on 7 times in the same run. - `cargo test` passed for the crates it touches: native `cargo test` cannot build `victory-gpu` on a Linux host (same on main), so no; `cargo xwin clippy` for the Windows target adds no warning over current main. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #3366 (stretched in a bordered window), #1615 (FSR 3 FG rectangle for bars, closed), #132.
The window lock of 49bfafbe fought Mutter under Wine's X11 driver (the
window snapped to its height). The window now resizes freely: when its
client area is at other proportions than the picture, the back buffer takes
the window's, the picture is drawn whole in its middle by the composer and
the rest is black, so that the swap chain's scaling to the window (vkd3d-
proton only stretches) never stretches the picture. DLSS Frame Generation is
told the picture's part of the back buffer (kBufferTypeBackbuffer, 53, with
its extent alone): the bars are copied as they are. VICTORY_LETTERBOX=0:
stretched, as before.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 06:08:06 +00:00
@ -2526,0 +2530,4 @@
// the back buffer alone, the bars are copied as they are. (Streamline
// knows the back buffer: the tag carries the extent only.)
let picture = crate::host::letterboxed();
if picture.is_some() || LETTERBOX_TAGGED.swap(picture.is_some(), Relaxed) {
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-30 07:11 UTC · original

|| skips its right-hand operand when picture.is_some() is true. That leaves LETTERBOX_TAGGED false during frames with bars, so the first full-size frame never emits the intended reset extent.

I ran the exact condition extracted from a2439f2 and from the one-line fix in a native Rust harness. With two transitions from bars to full size, the PR omitted both reset extents. With the swap evaluated first, both transitions emitted the full extent once. Consecutive full-size frames emitted nothing. This checks the tag decisions before the Streamline call. NVIDIA DLSS-G guide, backbuffer subrect

        if LETTERBOX_TAGGED.swap(picture.is_some(), Relaxed) || picture.is_some() {

Local fix bd7ab26 is based on the exact PR head. If incorporating it manually, please retain the Git author or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-30 07:11 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3755#discussion_r4735970466) `||` skips its right-hand operand when `picture.is_some()` is true. That leaves `LETTERBOX_TAGGED` false during frames with bars, so the first full-size frame never emits the intended reset extent. I ran the exact condition extracted from `a2439f2` and from the one-line fix in a native Rust harness. With two transitions from bars to full size, the PR omitted both reset extents. With the swap evaluated first, both transitions emitted the full extent once. Consecutive full-size frames emitted nothing. This checks the tag decisions before the Streamline call. [NVIDIA DLSS-G guide, backbuffer subrect](https://github.com/NVIDIA-RTX/Streamline/blob/main/docs/ProgrammingGuideDLSS_G.md#52-tagging-recommendations) ```suggestion if LETTERBOX_TAGGED.swap(picture.is_some(), Relaxed) || picture.is_some() { ``` Local fix `bd7ab26` is based on the exact PR head. If incorporating it manually, please retain the Git author or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with OpenAI Codex.
Author
Owner

@⁠stasadance on GitHub · 2026-11-30 08:22 UTC · original

Thanks @⁠andrewpozdnakov7-jpg, you're right: with || short-circuiting, the swap never ran on frames with bars, so the first full-size frame after them never re-tagged the whole back buffer. Fixed in f9feb31 by evaluating the swap first, as you suggested, with you as co-author.

**@⁠stasadance** on GitHub · 2026-11-30 08:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3755#discussion_r4736526269) Thanks @⁠andrewpozdnakov7-jpg, you're right: with `||` short-circuiting, the swap never ran on frames with bars, so the first full-size frame after them never re-tagged the whole back buffer. Fixed in f9feb31 by evaluating the swap first, as you suggested, with you as co-author.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-30 08:48 UTC · original

Retested the exact updated head f9feb31d on Windows. In the eight-frame fixture, both returns from bars to full size emitted the full extent once and the following full-size frames emitted no additional tag. This resolves the tag-decision issue I raised. The fixture stops before the Streamline call.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-30 08:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3755#discussion_r4736747846) Retested the exact updated head `f9feb31d` on Windows. In the eight-frame fixture, both returns from bars to full size emitted the full extent once and the following full-size frames emitted no additional tag. This resolves the tag-decision issue I raised. The fixture stops before the Streamline call.
github-bot force-pushed github-bot/gh-3755 from 9c3d1838c6 to 22f3adf8a1 2026-12-01 02:58:45 +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/3755/head:github-bot/gh-3755'
git switch 'github-bot/gh-3755'

Merge

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