Copy an unaligned root constant buffer once per list #24

Manually merged
github merged 1 commit from gh-pr/24/head into gh-pr/24/base 2026-11-26 03:33:21 +00:00
Owner

@⁠romainhedouin on GitHub · 2026-11-25 12:28 UTC · original
romainhedouin:perf/unaligned-cbv-reuse → main · +22 −3 · 2 files · 1 commits · merged 2026-11-25 17:09 UTC

When a root constant buffer is not 256-byte aligned on the host, the draw copies up to 64 KiB of title memory into upload memory at submission. Two draws of the same list that bound the same buffer made two identical copies. Now the second draw reuses the first copy. Anything in the list that writes title memory (a title copy or a run step) starts a new copy, so the GPU reads exactly the same bytes as before.

Per repeated binding in one list Before After
Bytes copied from title memory up to 65,536 0
Upload memory used up to 65,536 0
Copy steps at submission 1 0

Counts from the code; how often bindings repeat in the game is not measured yet. Type-checked for Windows (cargo clippy -p victory-gpu --target x86_64-pc-windows-msvc, with and without --all-features, no new warnings); not run.

🤖 Generated with Claude Code

**@⁠romainhedouin** on GitHub · 2026-11-25 12:28 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/24) `romainhedouin:perf/unaligned-cbv-reuse` → `main` · +22 −3 · 2 files · 1 commits · merged 2026-11-25 17:09 UTC When a root constant buffer is not 256-byte aligned on the host, the draw copies up to 64 KiB of title memory into upload memory at submission. Two draws of the same list that bound the same buffer made two identical copies. Now the second draw reuses the first copy. Anything in the list that writes title memory (a title copy or a run step) starts a new copy, so the GPU reads exactly the same bytes as before. | Per repeated binding in one list | Before | After | |---|---|---| | Bytes copied from title memory | up to 65,536 | 0 | | Upload memory used | up to 65,536 | 0 | | Copy steps at submission | 1 | 0 | Counts from the code; how often bindings repeat in the game is not measured yet. Type-checked for Windows (`cargo clippy -p victory-gpu --target x86_64-pc-windows-msvc`, with and without `--all-features`, no new warnings); not run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:33:19 +00:00
github manually merged commit 84ea9c12d3 into gh-pr/24/base 2026-11-26 03:33:21 +00:00
Author
Owner

@⁠Ekabusto on GitHub · 2026-11-25 12:47 UTC · original

Checked locally: builds, and cargo test -p victory-gpu --lib passes (109 passed, 4 ignored). Clippy shows nothing new, and there are no conflicts.

The cache is invalidated in the right places: Copy and Run are the only steps that write title memory before the fills run at submission, and both clear filled alongside refreshed. reset replaces the whole Deferred, so a stale scratch address cannot survive into the next recording. Looks good to me.

Reviewed on Windows 11 (build 26300), Rust 1.98.1, each PR in its own worktree; no game data, not run in the game. AI-assisted (Claude Code).

**@⁠Ekabusto** on GitHub · 2026-11-25 12:47 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/24#issuecomment-7162866566) Checked locally: builds, and `cargo test -p victory-gpu --lib` passes (109 passed, 4 ignored). Clippy shows nothing new, and there are no conflicts. The cache is invalidated in the right places: `Copy` and `Run` are the only steps that write title memory before the fills run at submission, and both clear `filled` alongside `refreshed`. `reset` replaces the whole `Deferred`, so a stale scratch address cannot survive into the next recording. Looks good to me. Reviewed on Windows 11 (build 26300), Rust 1.98.1, each PR in its own worktree; no game data, not run in the game. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
No description provided.