GPU: implement ClearUnorderedAccessViewUint/Float for buffers and textures #1162

Closed
github-bot wants to merge 1 commit from gh-pr/1162/head into gh-pr/1162/base
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 16:18 UTC · original
geiyiliyabumo:feat/uav-clear-buffers-and-textures → main · +1242 −21 · 5 files · 1 commits · closed without merging

Summary

Fixes #771

Full verification details and change notes are documented in #771 (commit 12e9c6a, based on main ffe310e).

 crates/victory-gpu/src/descriptor.rs      |  14 +
 crates/victory-gpu/src/descriptor/host.rs |  23 +-
 crates/victory-gpu/src/host.rs            | 195 +++++-
 crates/victory-gpu/src/list.rs            | 995 +++++++++++++++++++++++++++++-
 crates/victory-gpu/src/shadow.rs          |  36 ++
 5 files changed, 1242 insertions(+), 21 deletions(-)

Verification (Windows 11 x64 MSVC)

  • rustfmt --edition 2024 --check on edited files: PASS
  • cargo xtask policy: PASS (zero game files/data)
  • cargo clippy --all-targets --locked -- -D warnings (default + --features diagnostics where applicable): PASS
  • Targeted & crate unit/GPU tests: PASS

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 16:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/1162) `geiyiliyabumo:feat/uav-clear-buffers-and-textures` → `main` · +1242 −21 · 5 files · 1 commits · closed without merging ### Summary Fixes #771 Full verification details and change notes are documented in #771 (commit `12e9c6a`, based on `main` `ffe310e`). ```text crates/victory-gpu/src/descriptor.rs | 14 + crates/victory-gpu/src/descriptor/host.rs | 23 +- crates/victory-gpu/src/host.rs | 195 +++++- crates/victory-gpu/src/list.rs | 995 +++++++++++++++++++++++++++++- crates/victory-gpu/src/shadow.rs | 36 ++ 5 files changed, 1242 insertions(+), 21 deletions(-) ``` ### Verification (Windows 11 x64 MSVC) - `rustfmt --edition 2024 --check` on edited files: **PASS** - `cargo xtask policy`: **PASS** (zero game files/data) - `cargo clippy --all-targets --locked -- -D warnings` (default + `--features diagnostics` where applicable): **PASS** - Targeted & crate unit/GPU tests: **PASS** *AI-assisted; synthetic tests only, no game files.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:21:48 +00:00
github-bot closed this pull request 2026-11-26 04:21:48 +00:00
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 17:24 UTC · original

Reviewed 12e9c6a and tested same-command-list buffer clear + compute Dispatch ordering under the D3D12 Debug Layer on NVIDIA GeForce RTX 5090 and D3D12 WARP.

Two architectural notes worth considering for the buffer path:

  1. Native ClearUnorderedAccessView* on the shadow buffer avoids ID3D12GraphicsCommandList7 Enhanced Barrier fallback ordering hazards:
    • Instead of CPU-encoding format texels into staging memory and relying on ID3D12GraphicsCommandList7::Barrier (with a submission-time defer fallback that breaks ordering relative to earlier/later Dispatch calls on the same list), buffer UAV clears can record native ClearUnorderedAccessViewUint / ClearUnorderedAccessViewFloat directly against shadow.buffer:
      • Lazily allocate a 1-slot non-shader-visible CBV_SRV_UAV CPU heap on HostList (CopyDescriptorsSimple into a dynamic shader-visible HostHeap slot).
      • For ClearUnorderedAccessViewUint on DXGI_FORMAT_R32_TYPELESS + D3D12_BUFFER_UAV_FLAG_RAW (RWByteAddressBuffer), rewrite the clear view descriptor to DXGI_FORMAT_R32_UINT (Flags = NONE), then bracket the native clear with shadow.refresh + shadow.gpu_writes + D3D12_RESOURCE_BARRIER_TYPE_UAV.
    • That keeps the entire implementation ~310 lines without CPU format-packing tables and preserves exact intra-list ordering on standard ID3D12GraphicsCommandList.
  2. D3D12 Debug Layer verification:
    • Verified both texture sub-rect clears (R32G32B32A32_UINT, R32G32_FLOAT) and overlapping intra-list raw/typed buffer clears feeding an immediate cs_5_1 Dispatch with VICTORY_D3D12_DEBUG=1 on RTX 5090 and D3D12 WARP (0 debug layer errors) in fuzeofficlal/VIctory@c4c09b2 (fix/uav-clear-771).
**@⁠fuzeofficlal** on GitHub · 2026-11-24 17:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/1162#issuecomment-7139147400) Reviewed `12e9c6a` and tested same-command-list buffer clear + compute `Dispatch` ordering under the D3D12 Debug Layer on **NVIDIA GeForce RTX 5090** and **D3D12 WARP**. Two architectural notes worth considering for the buffer path: 1. **Native `ClearUnorderedAccessView*` on the shadow buffer avoids `ID3D12GraphicsCommandList7` Enhanced Barrier fallback ordering hazards**: - Instead of CPU-encoding format texels into staging memory and relying on `ID3D12GraphicsCommandList7::Barrier` (with a submission-time `defer` fallback that breaks ordering relative to earlier/later `Dispatch` calls on the same list), buffer UAV clears can record native `ClearUnorderedAccessViewUint` / `ClearUnorderedAccessViewFloat` directly against `shadow.buffer`: - Lazily allocate a 1-slot non-shader-visible `CBV_SRV_UAV` CPU heap on `HostList` (`CopyDescriptorsSimple` into a dynamic shader-visible `HostHeap` slot). - For `ClearUnorderedAccessViewUint` on `DXGI_FORMAT_R32_TYPELESS` + `D3D12_BUFFER_UAV_FLAG_RAW` (`RWByteAddressBuffer`), rewrite the clear view descriptor to `DXGI_FORMAT_R32_UINT` (`Flags = NONE`), then bracket the native clear with `shadow.refresh` + `shadow.gpu_writes` + `D3D12_RESOURCE_BARRIER_TYPE_UAV`. - That keeps the entire implementation ~310 lines without CPU format-packing tables and preserves exact intra-list ordering on standard `ID3D12GraphicsCommandList`. 2. **D3D12 Debug Layer verification**: - Verified both texture sub-rect clears (`R32G32B32A32_UINT`, `R32G32_FLOAT`) and overlapping intra-list raw/typed buffer clears feeding an immediate `cs_5_1` `Dispatch` with `VICTORY_D3D12_DEBUG=1` on **RTX 5090** and **D3D12 WARP** (`0` debug layer errors) in [`fuzeofficlal/VIctory@c4c09b2`](https://github.com/fuzeofficlal/VIctory/commit/c4c09b2fe70eed109c62d4658a8938224751f88d) (`fix/uav-clear-771`).
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 18:01 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 12e9c6a: cargo test -p victory-gpu passes, 57 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 18:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/1162#issuecomment-7140035379) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 12e9c6a: `cargo test -p victory-gpu` passes, 57 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:33 UTC · original

Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

ClearUnorderedAccessViewUint/Float is already served in main (list.rs 0x1a8/0x1b0 -> draw.rs State::clear_unordered, any view the title made at the CPU handle); nothing left to rebase.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/1162#issuecomment-7148627884) Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. ClearUnorderedAccessViewUint/Float is already served in main (list.rs 0x1a8/0x1b0 -> draw.rs State::clear_unordered, any view the title made at the CPU handle); nothing left to rebase. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

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!1162
No description provided.