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

Merged
LeonardoS11 merged 1 commit from upstream-pr/1260 into main 2026-11-26 05:16:35 +00:00
LeonardoS11 commented 2026-11-26 04:23:44 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by LeonardoS11 on 2026-11-26T04:23:44Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6619465858 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1260). Originally posted by [LeonardoS11](https://github.com/LeonardoS11) on 2026-11-26T04:23:44Z. --- ## 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)
Ym1r1710 commented 2026-11-26 05:05:54 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Ym1r1710 on 2026-11-26T04:42:05Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7182825691 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1260#issuecomment-7182825691). Originally posted by [Ym1r1710](https://github.com/Ym1r1710) on 2026-11-26T04:42:05Z. --- 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.
upstream-sync closed this pull request 2026-11-26 06:06:59 +00:00
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
fxceless/victory-fork!1257
No description provided.