GPU: align host copies for raw buffer UAVs #3073
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3075"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T06:38:22Z.
Fixes #771.
The remaining RAW buffer case could use a 4-byte-aligned offset when mirroring a guest UAV to D3D12. Use
D3D12_RAW_UAV_SRV_BYTE_ALIGNMENTto select the host copy both when creating the RAW descriptor and when refreshing and copying back its data. The descriptor still covers the original range in 32-bit elements.The synthetic guest
ClearUnorderedAccessViewUinttest clears four DWORDs through an odd-offset RAW view and checks all eight words, including the neighboring sentinels. It passed on Windows with app-local WARP 1.0.22 and D3D12 Agility 1.620.2. The fullvictory-gpudiagnostics suite passed 247 tests with one ignored. Strict GPU Clippy with all features and the asset policy passed. The title was not used.Coordination claim
AI-assisted with Codex. Please retain the Git author when cherry-picking or rebasing. If you fold this change into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T06:47:06Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT(16 bytes) forD3D12_BUFFER_UAV_FLAG_RAWin bothbuffer_uavandview_copyensures raw buffer UAVs and their refresh/copyback paths share the same 16-byte-aligned host copy even when the title view starts at a non-16-byte-aligned offset.cargo test -p victory-gpu list::tests -- --test-threads=1(RTX 5090 & WARP): 5 passed, 0 failed on both (includinga_raw_buffer_clear_keeps_words_outside_an_odd_offset_view).cargo test -p victory-gpu descriptor::host::tests -- --test-threads=1 --skip dynamic_slots_are_held_until_released(RTX 5090): 14 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T06:54:19Z.
Review: APPROVED
Verified: words[8] is D3D12_BUFFER_UAV.Flags for both Unordered and Placed(true) records (u64 FirstElement@2-3, NumElements@4, stride@5, u64 CounterOffset@6-7), and it is only read after buffer_range() confirms a buffer view. Passing alignment=16 (D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) for RAW into for_view makes the shadow's offset 16-aligned so the host descriptor satisfies the raw-UAV byte-offset rule; element stride preserved otherwise. The odd-offset clear test discriminates exactly.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T08:12:26Z.
Review: APPROVED
Tested locally on Windows 11 x64 (
rustc 1.98.1, NVIDIA GeForce RTX 5090 + WARP + D3D12 Debug Layer):cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default and--all-features): clean.list::tests --test-threads=1(5 passed, includinga_raw_buffer_clear_keeps_words_outside_an_odd_offset_view),descriptor::host::tests --test-threads=1 --skip dynamic_slots_are_held_until_released(14 passed).--features diagnostics,VICTORY_D3D12_WARP=1,VICTORY_D3D12_DEBUG=1):list::tests(5 passed) anddescriptor::host::tests(15 passed) with zero debug-layer errors.cargo xtask policy: 191 files ok.Using
D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT(16 bytes) consistently in bothbuffer_uavandview_copyensures the host descriptor'sFirstElementstays 4-DWORD (16-byte) aligned while refresh and copy-back hit the exact sameshadow::for_viewcopy key.Non-blocking follow-up note:
buffer_srv(descriptor/host.rs:1235) and the SRV arm ofview_copystill passelement(4) instead ofD3D12_RAW_UAV_SRV_BYTE_ALIGNMENT(16) forD3D12_BUFFER_SRV_FLAG_RAW, which has the same 16-byte offset rule in D3D12. Worth mirroring in a small follow-up if odd-offset raw SRVs come up.LGTM.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T08:22:09Z.
Automated triage for the maintainers.
Merge candidate.
descriptor::host::buffer_uavnow asksshadow::for_viewfor a 16-byte-aligned copy (D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) when the view is RAW, soFirstElement = shadow.offset(start) / 4always lands on a 16-byte boundary (the arena already places exact copies on multiples of 256).view_copyreads the UAV flags from the same descriptor words (dword 8 isFlagsin the host layout) and passes the same alignment, so the refresh and copy-back indraw.rs/bindless.rsfind the sameEXACTentry instead of a 4-aligned one. This is the odd-offset raw case the triage note on #771 asked for. The new testa_raw_buffer_clear_keeps_words_outside_an_odd_offset_viewchecks the neighbouring sentinels. CI: passing.A note, not a blocker:
buffer_srvstill uses a 4-byte element for raw SRVs, and those have the same 16-byte rule on the host. A follow-up could sharebuffer_uav_alignmentwith that path.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.