GPU: align host copies for raw buffer UAVs #3075

Open
github-bot wants to merge 1 commit from github-bot/gh-3075 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 06:38 UTC · original
andrewpozdnakov7-jpg:fix/771-raw-uav-alignment → main · +75 −2 · 2 files · 1 commits · open

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_ALIGNMENT to 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 ClearUnorderedAccessViewUint test 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 full victory-gpu diagnostics 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]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 06:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/3075) `andrewpozdnakov7-jpg:fix/771-raw-uav-alignment` → `main` · +75 −2 · 2 files · 1 commits · open 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_ALIGNMENT` to 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 `ClearUnorderedAccessViewUint` test 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 full `victory-gpu` diagnostics 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](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) 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]>`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:54:54 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 08:22 UTC · original

Automated triage for the maintainers.

Merge candidate. descriptor::host::buffer_uav now asks shadow::for_view for a 16-byte-aligned copy (D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) when the view is RAW, so FirstElement = shadow.offset(start) / 4 always lands on a 16-byte boundary (the arena already places exact copies on multiples of 256). view_copy reads the UAV flags from the same descriptor words (dword 8 is Flags in the host layout) and passes the same alignment, so the refresh and copy-back in draw.rs/bindless.rs find the same EXACT entry instead of a 4-aligned one. This is the odd-offset raw case the triage note on #771 asked for. The new test a_raw_buffer_clear_keeps_words_outside_an_odd_offset_view checks the neighbouring sentinels. CI: passing.

A note, not a blocker: buffer_srv still uses a 4-byte element for raw SRVs, and those have the same 16-byte rule on the host. A follow-up could share buffer_uav_alignment with that path.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 08:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/3075#issuecomment-7186509756) <!-- victory-triage v1 head=f4b814d8832c610509951e24a264e60922ec3e04 verdict=merge-candidate at=2026-11-26T08:18:02Z --> Automated triage for the maintainers. Merge candidate. `descriptor::host::buffer_uav` now asks `shadow::for_view` for a 16-byte-aligned copy (`D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT`) when the view is RAW, so `FirstElement = shadow.offset(start) / 4` always lands on a 16-byte boundary (the arena already places exact copies on multiples of 256). `view_copy` reads the UAV flags from the same descriptor words (dword 8 is `Flags` in the host layout) and passes the same alignment, so the refresh and copy-back in `draw.rs`/`bindless.rs` find the same `EXACT` entry instead of a 4-aligned one. This is the odd-offset raw case the triage note on #771 asked for. The new test `a_raw_buffer_clear_keeps_words_outside_an_odd_offset_view` checks the neighbouring sentinels. CI: passing. A note, not a blocker: `buffer_srv` still uses a 4-byte element for raw SRVs, and those have the same 16-byte rule on the host. A follow-up could share `buffer_uav_alignment` with that path. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3075/head:github-bot/gh-3075'
git switch 'github-bot/gh-3075'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3075'
git switch 'github-bot/gh-3075'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3075'
git switch 'github-bot/gh-3075'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3075'
git switch 'main'
git merge --squash 'github-bot/gh-3075'
git switch 'main'
git merge --ff-only 'github-bot/gh-3075'
git switch 'main'
git merge 'github-bot/gh-3075'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3075
No description provided.