GPU: a constant buffer view of no bytes stays one (2ba6e1f made it 256 bytes of the host copy: a flickering floor) #1260

Manually merged
github merged 1 commit from gh-pr/1260/head into gh-pr/1260/base 2026-11-26 06:07:07 +00:00
Owner

@⁠LeonardoS11 on GitHub · 2026-11-26 04:23 UTC · original
LeonardoS11:fix/cbv-no-bytes → main · +7 −1 · 1 files · 1 commits · merged 2026-11-26 05:16 UTC

What

constant_view_size() (2ba6e1f, the 64 KiB cap from fork PR #911; kept by a183ea2) rounds size.max(1) up to 256. For every size from 1 to 65,536 that is what it did before the cap. For size 0 it is not: before 2ba6e1f a view the title names with SizeInBytes 0 was made with 0 bytes and a shader read zeros through it; since then it is a 256-byte view of whatever lies at its address in the host copy, the ring of per-draw constants among it, so other bytes every frame.

This PR drops the max(1): the cap stays as it is, a view of no bytes stays one. Two asserts added to the existing test (0 -> 0, 1 -> 256).

What it looks like

In the first room of the prologue (Series S profile), the courtyard floor seen through the window flickers between two looks, every run. The "over 64 KiB" line never fires in these runs, so the cap itself never acts there; the size-0 case is the only one the commit changes for them.

How it was found

By eye, on an RTX 3080 Ti 12 GB, Windows 11 26200, Series S profile, 300 s runs, same switches throughout, over an integration branch (main plus some open PRs):

build floor
before the merge of main 32b31f7..006c353 (3 builds) steady
with that merge (7 builds and variants: with and without #1171, #1192, #1195, #1237's cache, the wide card compare, VICTORY_VIDEO_LOOK=0) flickers
that merge without 96ff135 flickers
that merge without d03859a flickers
that merge without 2ba6e1f (2 builds) steady
that merge with 2ba6e1f and this change steady

With this change and a line added for the occasion, the title does make such a view in that room (size=0, once a run is enough to see it).

Not done

  • The test was not run on this branch by itself; the same change is compiled and was run in the game in our integration branch.
  • Not looked at: whether a view of no bytes should rather be bound as a null view. Size 0 is what the tree made before 2ba6e1f, and NVIDIA takes it (no device removal in our runs).

🤖 Generated with Claude Code

**@⁠LeonardoS11** on GitHub · 2026-11-26 04:23 UTC · [original](https://github.com/fxceless/victory-fork/pull/1260) `LeonardoS11:fix/cbv-no-bytes` → `main` · +7 −1 · 1 files · 1 commits · merged 2026-11-26 05:16 UTC ## What `constant_view_size()` (2ba6e1f, the 64 KiB cap from fork PR #911; kept by a183ea2) rounds `size.max(1)` up to 256. For every size from 1 to 65,536 that is what it did before the cap. For **size 0** it is not: before 2ba6e1f a view the title names with `SizeInBytes` 0 was made with 0 bytes and a shader read zeros through it; since then it is a 256-byte view of whatever lies at its address in the host copy, the ring of per-draw constants among it, so other bytes every frame. This PR drops the `max(1)`: the cap stays as it is, a view of no bytes stays one. Two asserts added to the existing test (0 -> 0, 1 -> 256). ## What it looks like In the first room of the prologue (Series S profile), the courtyard floor seen through the window flickers between two looks, every run. The "over 64 KiB" line never fires in these runs, so the cap itself never acts there; the size-0 case is the only one the commit changes for them. ## How it was found By eye, on an RTX 3080 Ti 12 GB, Windows 11 26200, Series S profile, 300 s runs, same switches throughout, over an integration branch (main plus some open PRs): | build | floor | |---|---| | before the merge of main `32b31f7..006c353` (3 builds) | steady | | with that merge (7 builds and variants: with and without #1171, #1192, #1195, #1237's cache, the wide card compare, `VICTORY_VIDEO_LOOK=0`) | flickers | | that merge without 96ff135 | flickers | | that merge without d03859a | flickers | | that merge without 2ba6e1f (2 builds) | steady | | that merge with 2ba6e1f and this change | steady | With this change and a line added for the occasion, the title does make such a view in that room (`size=0`, once a run is enough to see it). ## Not done - The test was not run on this branch by itself; the same change is compiled and was run in the game in our integration branch. - Not looked at: whether a view of no bytes should rather be bound as a null view. Size 0 is what the tree made before 2ba6e1f, and NVIDIA takes it (no device removal in our runs). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
constant_view_size() took size.max(1) before rounding to 256, so a view the
title names with SizeInBytes 0 became a 256-byte view of whatever lies at its
address in the host copy. The cap over 64 KiB is unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:07:05 +00:00
github manually merged commit 619b2dc5c4 into gh-pr/1260/base 2026-11-26 06:07:07 +00:00
Author
Owner

@⁠Ym1r1710 on GitHub · 2026-11-26 04:42 UTC · original

Tried this on an RTX 5080 (Series X profile, first room): two runs with the change, no device loss, no new refused pipelines, frame time same as before (102.6 / 103.8 ms median vs 100.7 / 101.0 without). So zero-byte CBVs don't seem to bother NVIDIA here. I only sample every 16th frame so I can't say much about the flicker itself, but the courtyard through the window looked the same in both.

**@⁠Ym1r1710** on GitHub · 2026-11-26 04:42 UTC · [original](https://github.com/fxceless/victory-fork/pull/1260#issuecomment-7182825691) Tried this on an RTX 5080 (Series X profile, first room): two runs with the change, no device loss, no new refused pipelines, frame time same as before (102.6 / 103.8 ms median vs 100.7 / 101.0 without). So zero-byte CBVs don't seem to bother NVIDIA here. I only sample every 16th frame so I can't say much about the flicker itself, but the courtyard through the window looked the same in both.
This discussion has been locked. Commenting is limited to contributors.
No description provided.