GPU: mesh vertex blocks cut off at the end of a 4 MiB window (vehicle panels missing, matte paint, decals gone) #1197

Manually merged
github merged 2 commits from github-bot/gh-1197 into main 2026-11-28 19:41:59 +00:00 AGit
Owner

@⁠CristianCiubancan on GitHub · 2026-11-28 15:23 UTC · original
CristianCiubancan:fix/root-view-reach → main · +117 −17 · 1 files · 2 commits · merged 2026-11-28 19:39 UTC

What was wrong. Some vehicles are drawn with doors or panels missing or stretched across the body, with flat matte paint up close, or with a decal covering only part of the body. It comes and goes with distance and differs from vehicle to vehicle.

The title binds each mesh's vertex block as a root view. A root view has no length; the console reads from its address as far as the mesh program goes. Here, title memory outside buffer objects is copied in 4 MiB windows, and root_view gives such a view what is left of its window (shadow.left(address)). A block that begins near the end of a 4 MiB cell is cut off there, and reads past the view's end return zero.

One case, from a recorded frame (RTX 5070 Ti, Series X profile): a van's body, one draw of 233 meshlets (MSR_VS_TransformSkinD_NoDeform).

Block begins 131,008 bytes below the cell's end
Last stream begins at 970,244 bytes; the block is about 1.15 MB
Positions (8 bytes each, from +128) 16,360 of about 23,100 vertices inside the view
Normals, texture coordinates, part numbers all past the view's end

In that frame's main pass, 3,613 views had no length; for 4 of them a stream began past the window's end. That count is a lower bound: it does not include streams that begin inside and run past.

The change. A window asked for without a length is its 4 MiB cell plus a reach into the next: VICTORY_WINDOW_REACH_KB, 2048 by default, a multiple of 64 up to 4096, 0 for the old behaviour. An ask with a length whose window is that cell names the same window, so a cell's memory is held once. Tails (VICTORY_WINDOW_TAILS=1) reach as far. in_place_let_go looks back by the longer window.

What it costs. Every whole-cell window grows by the reach. In a diagnostics session six minutes into play there were 965 windows, so at most about +1.9 GB at 2 MiB and about +1 GB at 1 MiB (computed from the window count). Measured by another user on the first commit, same scene with the reach at 0 and at 2048: +0.3 GB on the card and +1.3 GB shared, 17.8 against 17.4 fps (see the comments).

What it does not cover. A block longer than the reach that begins nearer than its own length to the line is still cut. The largest stream offset in the frame was 2.4 MB, so 2 MiB leaves a small remainder and 4 MiB would not. I chose 2 MiB for the memory; say if you would rather have another default.

Tested.

  • New unit test an_unsized_ask_reads_past_its_cells_end, with the van's numbers: cut off at reach 0, whole at the default.
  • cargo test -p victory-gpu --lib: 455 passed, 0 failed, 36 ignored.
  • In the game, on a build of this plus #996: the user who reported the symptoms saw vehicle panels, paint and decals correct where they were broken before. No frame-rate change seen (about 17 fps in both sessions; not a controlled comparison).

Not replayed offline: the fix changes which windows are made, which a recorded frame cannot show.

🤖 Generated with Claude Code

**@⁠CristianCiubancan** on GitHub · 2026-11-28 15:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1197) `CristianCiubancan:fix/root-view-reach` → `main` · +117 −17 · 1 files · 2 commits · merged 2026-11-28 19:39 UTC **What was wrong.** Some vehicles are drawn with doors or panels missing or stretched across the body, with flat matte paint up close, or with a decal covering only part of the body. It comes and goes with distance and differs from vehicle to vehicle. The title binds each mesh's vertex block as a root view. A root view has no length; the console reads from its address as far as the mesh program goes. Here, title memory outside buffer objects is copied in 4 MiB windows, and `root_view` gives such a view what is left of its window (`shadow.left(address)`). A block that begins near the end of a 4 MiB cell is cut off there, and reads past the view's end return zero. **One case, from a recorded frame** (RTX 5070 Ti, Series X profile): a van's body, one draw of 233 meshlets (`MSR_VS_TransformSkinD_NoDeform`). | | | |---|---| | Block begins | 131,008 bytes below the cell's end | | Last stream begins at | 970,244 bytes; the block is about 1.15 MB | | Positions (8 bytes each, from +128) | 16,360 of about 23,100 vertices inside the view | | Normals, texture coordinates, part numbers | all past the view's end | In that frame's main pass, 3,613 views had no length; for 4 of them a stream began past the window's end. That count is a lower bound: it does not include streams that begin inside and run past. **The change.** A window asked for without a length is its 4 MiB cell plus a reach into the next: `VICTORY_WINDOW_REACH_KB`, 2048 by default, a multiple of 64 up to 4096, 0 for the old behaviour. An ask with a length whose window is that cell names the same window, so a cell's memory is held once. Tails (`VICTORY_WINDOW_TAILS=1`) reach as far. `in_place_let_go` looks back by the longer window. **What it costs.** Every whole-cell window grows by the reach. In a diagnostics session six minutes into play there were 965 windows, so at most about +1.9 GB at 2 MiB and about +1 GB at 1 MiB (computed from the window count). Measured by another user on the first commit, same scene with the reach at 0 and at 2048: +0.3 GB on the card and +1.3 GB shared, 17.8 against 17.4 fps (see the comments). **What it does not cover.** A block longer than the reach that begins nearer than its own length to the line is still cut. The largest stream offset in the frame was 2.4 MB, so 2 MiB leaves a small remainder and 4 MiB would not. I chose 2 MiB for the memory; say if you would rather have another default. **Tested.** - New unit test `an_unsized_ask_reads_past_its_cells_end`, with the van's numbers: cut off at reach 0, whole at the default. - `cargo test -p victory-gpu --lib`: 455 passed, 0 failed, 36 ignored. - In the game, on a build of this plus #996: the user who reported the symptoms saw vehicle panels, paint and decals correct where they were broken before. No frame-rate change seen (about 17 fps in both sessions; not a controlled comparison). Not replayed offline: the fix changes which windows are made, which a recorded frame cannot show. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title binds each mesh's vertex block as a root view, which has no
length: the console reads from the address as far as the program goes.
The window of title memory behind such a view ended with its 4 MiB cell,
so a block that began near the cell's end was cut off and what lay past
it read zeros: vehicle bodies with panels missing or drawn as slabs
across the body, matte paint, decals missing from part of the body.

A window asked for without a length is now its cell and
VICTORY_WINDOW_REACH_KB of the next (2048 by default; 0: as before).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 15:27:36 +00:00
Author
Owner

@⁠cxy0072019-sketch on GitHub · 2026-11-28 16:10 UTC · original

Series S follow-up on an RTX 5070 Ti 16 GB and i5-14600KF under Windows. I used one diagnostics release build of 906f656 plus #996 (216bca9) and varied only VICTORY_WINDOW_REACH_KB. Both runs used the same cloned Gear Up parking save, initially identical emulator caches, separate fresh driver caches, 1920×1080 output, internal Series S 720p, and DLSS and frame generation off.

After the pipelines settled 0 KiB 2048 KiB
Median rendered FPS 17.8 17.4
Median draws per frame 3,185 3,179
Median local video-memory use, reported MB 7,197 7,497
Median shared GPU-memory use, reported MB 5,757 7,059
Median size of a window asked for without a length 4 MiB 6 MiB

Each side used nine complete five-second samples from the same parked camera. The tested pickup already showed its panels and decals at 0 KiB, and both runs completed the same parking-lot inputs. The reported broken van remains unverified in this scene. an_unsized_ask_reads_past_its_cells_end passed locally. This one restart pair provides a measurement of memory and frame time for a Series S scene. Test automation and analysis were AI-assisted.

**@⁠cxy0072019-sketch** on GitHub · 2026-11-28 16:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1197#issuecomment-7242033670) Series S follow-up on an RTX 5070 Ti 16 GB and i5-14600KF under Windows. I used one diagnostics release build of `906f656` plus #996 (`216bca9`) and varied only `VICTORY_WINDOW_REACH_KB`. Both runs used the same cloned Gear Up parking save, initially identical emulator caches, separate fresh driver caches, 1920×1080 output, internal Series S 720p, and DLSS and frame generation off. | After the pipelines settled | 0 KiB | 2048 KiB | | --- | ---: | ---: | | Median rendered FPS | 17.8 | 17.4 | | Median draws per frame | 3,185 | 3,179 | | Median local video-memory use, reported MB | 7,197 | 7,497 | | Median shared GPU-memory use, reported MB | 5,757 | 7,059 | | Median size of a window asked for without a length | 4 MiB | 6 MiB | Each side used nine complete five-second samples from the same parked camera. The tested pickup already showed its panels and decals at 0 KiB, and both runs completed the same parking-lot inputs. The reported broken van remains unverified in this scene. `an_unsized_ask_reads_past_its_cells_end` passed locally. This one restart pair provides a measurement of memory and frame time for a Series S scene. Test automation and analysis were AI-assisted.
With the reach, an ask without a length named a 6 MiB window while an
ask with a length in the same cell still named the 4 MiB one: two
copies of the same memory where there was one. On the 4 MiB grid an
ask with a length whose window is that cell now names the long window
too. Asks cut finer than a cell, or over more than one, name the
window they did.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Author
Owner

@⁠CristianCiubancan on GitHub · 2026-11-28 16:18 UTC · original

A correction to my own PR, found while tracing something else in a recorded frame.

As first pushed, an ask without a length named a 6 MiB window while asks with a length in the same cell kept naming the 4 MiB one. The recorded frame shows both alive for the same memory (title memory 0xc57c00000+0x400000 beside +0x600000). So the cost I gave, about +1.4 GB, was too low: cells with both kinds of ask were held twice.

The second commit makes every ask inside a cell name the cell's one long window, on the 4 MiB grid. The memory is held once again and the choice does not depend on which ask came first.

The cost, restated. Every whole-cell window grows by the reach. From the same diagnostics session (965 windows six minutes in), that is at most about +1.9 GB at the default of 2 MiB and about +1 GB at 1 MiB. These are computed from the window count, not measured on the corrected build.

Tests: cargo test -p victory-gpu --lib, 455 passed, 0 failed; the unit test now also covers asks with a length.

The description above is updated to match.

Thanks for the measurement. It was taken on the first commit, which held some cells twice; the second commit removes that, so the split between card and shared memory may differ on it.

On reproducing the picture: whether a mesh is cut depends on where its block lies relative to a 4 MiB line, so a given vehicle may be whole in one session and cut in another. The van in the description is from a recorded frame, and an_unsized_ask_reads_past_its_cells_end uses its numbers.

**@⁠CristianCiubancan** on GitHub · 2026-11-28 16:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1197#issuecomment-7242135607) A correction to my own PR, found while tracing something else in a recorded frame. As first pushed, an ask without a length named a 6 MiB window while asks with a length in the same cell kept naming the 4 MiB one. The recorded frame shows both alive for the same memory (`title memory 0xc57c00000+0x400000` beside `+0x600000`). So the cost I gave, about +1.4 GB, was too low: cells with both kinds of ask were held twice. The second commit makes every ask inside a cell name the cell's one long window, on the 4 MiB grid. The memory is held once again and the choice does not depend on which ask came first. **The cost, restated.** Every whole-cell window grows by the reach. From the same diagnostics session (965 windows six minutes in), that is at most about +1.9 GB at the default of 2 MiB and about +1 GB at 1 MiB. These are computed from the window count, not measured on the corrected build. Tests: `cargo test -p victory-gpu --lib`, 455 passed, 0 failed; the unit test now also covers asks with a length. The description above is updated to match. Thanks for the measurement. It was taken on the first commit, which held some cells twice; the second commit removes that, so the split between card and shared memory may differ on it. On reproducing the picture: whether a mesh is cut depends on where its block lies relative to a 4 MiB line, so a given vehicle may be whole in one session and cut in another. The van in the description is from a recorded frame, and `an_unsized_ask_reads_past_its_cells_end` uses its numbers.
Author
Owner

@⁠CristianCiubancan on GitHub · 2026-11-28 16:25 UTC · original

The second commit (bfb3749) has now been run in the game too, on a build of this branch's two commits plus #996: the van whose panels, paint and decals were broken before still shows them right, as it did on the first commit.

**@⁠CristianCiubancan** on GitHub · 2026-11-28 16:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1197#issuecomment-7242229920) The second commit (`bfb3749`) has now been run in the game too, on a build of this branch's two commits plus #996: the van whose panels, paint and decals were broken before still shows them right, as it did on the first commit.
github-bot referenced this pull request from a commit 2026-11-28 19:41:56 +00:00
github manually merged commit f221787438 into main 2026-11-28 19:41:59 +00:00
Author
Owner

@⁠Mumogg on GitHub · 2026-11-28 21:28 UTC · original

Tested on Linux, and it fixes the missing car doors for us.

Setup: RTX 5070 Ti, Ryzen 5 9600X, Nobara (Wine 11.22 staging + vkd3d-proton), 4K output, Series X profile.

Before this PR, car doors and panels came and went up close, from run to run and car to car. After cherry-picking both commits (906f6565 and bfb37497) onto our branch with the default VICTORY_WINDOW_REACH_KB=2048, the doors were present on every car the player walked up to. That was over a whole play session and several cars. Fps was unchanged within noise.

AI-assisted: this test and report were made with Claude Code; the person playing confirmed the result in game.

🤖 Generated with Claude Code

**@⁠Mumogg** on GitHub · 2026-11-28 21:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1197#issuecomment-7246048301) Tested on Linux, and it fixes the missing car doors for us. Setup: RTX 5070 Ti, Ryzen 5 9600X, Nobara (Wine 11.22 staging + vkd3d-proton), 4K output, Series X profile. Before this PR, car doors and panels came and went up close, from run to run and car to car. After cherry-picking both commits (906f6565 and bfb37497) onto our branch with the default `VICTORY_WINDOW_REACH_KB=2048`, the doors were present on every car the player walked up to. That was over a whole play session and several cars. Fps was unchanged within noise. _AI-assisted: this test and report were made with Claude Code; the person playing confirmed the result in game._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠Rafa7046 on GitHub · 2026-11-28 23:10 UTC · original

A memory cost of this one, found by bisecting main (32ecacf..923e38c, first-parent) on the process's private memory. Setup: RTX 5080 16 GB, 9950X3D, 64 GB, Series X, 1440p, DLSS Performance, RT off. A scripted run (prologue cutscenes, then the boat); memory read about 130 s into the scene, where it has settled.

  • Merge of #1183 (just before): private 33,042 MB, GPU shared 10.5 GB.
  • Merge of #1197: private 36,658 MB, GPU shared 13.6 GB.

VICTORY_WINDOW_REACH_KB on today's main (d4b5d51), same scene:

reach private GPU shared median fps (short run)
0 (as before) 33,482 MB 11.0 GB 39.0
1024 35,251 MB 12.7 GB 39.9
2048 (default) 36,604 MB 13.6 GB 38.5

That is about 1.5 GB of RAM and 1.3 GB of GPU-visible system memory per MiB of reach. No fps change on this machine, and 64 GB hides it. On a 16 or 32 GB PC, about 3–3.5 GB of each could matter (out-of-memory, paging).

Every unsized window grows by the reach, while only views that begin within the reach of their cell's end need it. Giving the reach only to cells where such a view is asked would keep the vehicle fix for a fraction of this. I'm trying that locally and will open a PR if it holds up.

Measurements prepared with an AI assistant (Claude Code); the runs were played on my machine.

**@⁠Rafa7046** on GitHub · 2026-11-28 23:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1197#issuecomment-7247251996) A memory cost of this one, found by bisecting `main` (`32ecacf..923e38c`, first-parent) on the process's private memory. Setup: RTX 5080 16 GB, 9950X3D, 64 GB, Series X, 1440p, DLSS Performance, RT off. A scripted run (prologue cutscenes, then the boat); memory read about 130 s into the scene, where it has settled. - Merge of #1183 (just before): private 33,042 MB, GPU shared 10.5 GB. - Merge of #1197: private 36,658 MB, GPU shared 13.6 GB. `VICTORY_WINDOW_REACH_KB` on today's `main` (`d4b5d51`), same scene: | reach | private | GPU shared | median fps (short run) | |---|---:|---:|---:| | 0 (as before) | 33,482 MB | 11.0 GB | 39.0 | | 1024 | 35,251 MB | 12.7 GB | 39.9 | | 2048 (default) | 36,604 MB | 13.6 GB | 38.5 | That is about 1.5 GB of RAM and 1.3 GB of GPU-visible system memory per MiB of reach. No fps change on this machine, and 64 GB hides it. On a 16 or 32 GB PC, about 3–3.5 GB of each could matter (out-of-memory, paging). Every unsized window grows by the reach, while only views that begin within the reach of their cell's end need it. Giving the reach only to cells where such a view is asked would keep the vehicle fix for a fraction of this. I'm trying that locally and will open a PR if it holds up. Measurements prepared with an AI assistant (Claude Code); the runs were played on my machine.
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!1197
No description provided.