Copy an unaligned root constant buffer once per list #24

Merged
romainhedouin merged 1 commit from upstream-pr/24 into main 2026-11-25 17:09:21 +00:00
romainhedouin commented 2026-11-25 12:28:48 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by romainhedouin on 2026-11-25T12:28:48Z.


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

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:6604484940 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/24). Originally posted by [romainhedouin](https://github.com/romainhedouin) on 2026-11-25T12:28:48Z. --- 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)
Ekabusto commented 2026-11-25 12:47:41 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by Ekabusto on 2026-11-25T12:47:41Z.


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).

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7162866566 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/24#issuecomment-7162866566). Originally posted by [Ekabusto](https://github.com/Ekabusto) on 2026-11-25T12:47:41Z. --- 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).
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
Belobug/VIctory-Belobug-AMD!24
No description provided.