Skip to content

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

Merged
fxceless merged 1 commit into
fxceless:mainfrom
LeonardoS11:fix/cbv-no-bytes
Nov 26, 2026
Merged

fxceless merged 1 commit into
fxceless:mainfrom
LeonardoS11:fix/cbv-no-bytes

Conversation

@LeonardoS11

Copy link
Copy Markdown

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

…es of the host copy; a floor flickered)

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 <noreply@anthropic.com>
@Ym1r1710

Ym1r1710 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

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.

dkdknight added a commit to dkdknight/victory-fork that referenced this pull request Nov 26, 2026
…ounded 0 up to 256)

From fxceless/victory-fork PR fxceless#1260 (LeonardoS11): since 2ba6e1f a view the title names with SizeInBytes 0
became 256 bytes of whatever lay at its address (the ring of per-draw constants among it); the courtyard
floor seen through the cell window flickered between two looks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fxceless
fxceless merged commit be721d5 into fxceless:main Nov 26, 2026
grosterr added a commit to grosterr/victory-fork that referenced this pull request Nov 26, 2026
Conflicts resolved with both sides kept:
- descriptor/host.rs: main's constant_view_size (CBV cap, fxceless#1206/fxceless#1260) and made_now
  records; the stack's tiled-slot bookkeeping (5181f96: record_tiled, forget_tiled,
  tiled_stale) with made_now stored after the slot is made and kept.
- drvwatch.rs: fxceless#1101's query (every driver entry, the Display source from warning up)
  kept with its test; main's QUERY (fxceless#1255) dropped as the same filter; its Auto HDR
  note moved into the comment.
- host.rs: main's batched hash passes (CARD_SYNC_BATCH) with the stack's census::sent;
  the view-set line beside main's video memory line.
- pipeline/host.rs: the stack's host_blend and main's integer_targets_do_not_blend both
  stay (main's clears blending when the state is read, the stack's at creation).
- texture.rs: Last keeps fxceless#768's motion and main's ahead; the hash turn honours both.
- watch.rs: known_view asks main's light-refresh bits first, then the stack's view set;
  one title_memory_committed doing both (parked/absent blocks back to unclean, and
  ABSENT_ONCE notes and their hole bits forgotten).
- xmem.rs: main's on_commit with fxceless#1185's caller address.
- tiles.rs: the stack's kept-by-a-list test and main's resident-view LOD test (fxceless#1210).
- emit/mod.rs: the stack's paired-form-first closure and main's WAVE_WIDE=last; its
  result keeps the stack's (shader, groups) return type.
- indirect.rs, resource.rs, lib.rs: main's.
- README.md ours; README-upstream.md from main with fxceless#1057's wording.
Two main watch tests assumed no view set (fxceless#812 parks placeholder holes until the
runtime tells): the ABSENT_ONCE test's silent-mapping expectations depend on view_set(),
and the light-refresh hole test runs with VICTORY_VIEW_SET=0; both pass unchanged there.

NB: fxceless#1014's 64-thread hash is opt-in now (VICTORY_CARD_HASH_WIDE=1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 26, 2026
…d VICTORY_DYNAMIC_SLOTS

The two together on main: victory-gpu 264 passed with diagnostics, the
build without them compiles; build c261b45.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 26, 2026
What comes from upstream (previous merge base 988aa41):
- VICTORY_HEAP_WORKER=1 (off): textures picked by index uploaded by a
  thread of their own (fork pull request fxceless#1007); needs VICTORY_LATE_WAIT
  (stage > 0, which the relay sets by default).
- VICTORY_TABLE_STAGES (off): a draw's stages share the tables they make
  afresh.
- VICTORY_HEAP_LOCKS (off): made slots found without the slots' lock
  (atomic made_now), kept resources in 64 locks.
- VICTORY_BAKE_SOURCES=count|1 (off): skin-bake draws' own textures
  (fxceless#1264 hand-ported onto the texture worker).
- VICTORY_REAPER (off): host objects let go dropped by a thread of their own.
- VICTORY_TILES_SMALL_WHEN_FULL_MB and VICTORY_RETIRE_LEAN (both off).
- Legacy multiply-add as RDNA 2 runs it (pull request fxceless#1026).
- Typed views of 32-bit integer formats made in the float format of the
  same width (pull request fxceless#684).
- Remapping time split in the frame log (unmap, map, commit, our notes).
- The corner box shows the machine's load beside the frame rate
  (VICTORY_FPS_COUNTER=fps: the rate alone; =0: off).
- A report at a device removal; placed-slot census; constant buffer view
  of no bytes stays one (fxceless#1260, one copy kept); diagnostics runs 301-309.

Conflicts:
- README.md: ours kept as is; upstream's added as README.upstream.md.
  .github/workflows/ci.yml unchanged from ours.
- crates/victory-gpu/src/descriptor/host.rs: both. Our SlotSet and slot
  flags beside upstream's KEPT_PIECES/heap_locks(); HostHeap::new takes
  the 64 kept pieces and kept_one, sized count + extra, with next/free
  sized by our per-heap dynamic count (extra), not DYNAMIC. The lock-free
  made_now lookup goes in mirror_inner, before the records' lock (our
  mirror_with_made is called with the lock held), returning (view, None);
  made_now stores added to our keep-views return and after our make/keep
  branches.
- crates/victory-gpu/src/draw.rs: upstream's bake-sources/worker pass
  setup, with our TEXTURE_SHORT short_room/since_short in front of it;
  our ShortOfRoom guard kept before upstream's List/Ahead view lookup.
- crates/victory-hle/src/modules/xmem.rs: our title_memory_view call
  (section.handle) plus upstream's RemapNotesUs timing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants