GPU: turn zero-element buffer SRVs and UAVs into null descriptors #1426

Closed
fuzeofficlal wants to merge 1 commit from upstream-pr/1427 into main
fuzeofficlal commented 2026-11-24 17:57:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T17:57:52Z.


Fixes #912.

Summary

  • Check desc.Anonymous.Buffer.NumElements == 0 at the top of buffer_srv and buffer_uav (before shadow::find), log via once!, and return None so HostHeap writes a type-matched null buffer descriptor instead of calling CreateShaderResourceView / CreateUnorderedAccessView with NumElements == 0 and removing the host device (0x887A0001).

Verification

  • Added HostHeap unit tests and a multi-adapter D3D12 Debug Layer + ID3D12InfoQueue compute dispatch readback test exercising NumElements == 0 alongside non-empty buffer SRVs/UAVs:
    • NVIDIA GeForce RTX 5090 (Debug Layer + InfoQueue): passed (0 errors)
    • AMD Radeon(TM) Graphics (Debug Layer + InfoQueue): passed (0 errors)
    • Microsoft D3D12 WARP (Debug Layer + InfoQueue): passed (0 errors)
  • cargo clippy --workspace --all-targets --all-features and cargo xtask policy: passed.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6588127712 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1427). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T17:57:52Z. --- Fixes #912. ### Summary - Check `desc.Anonymous.Buffer.NumElements == 0` at the top of `buffer_srv` and `buffer_uav` (before `shadow::find`), log via `once!`, and return `None` so `HostHeap` writes a type-matched null buffer descriptor instead of calling `CreateShaderResourceView` / `CreateUnorderedAccessView` with `NumElements == 0` and removing the host device (`0x887A0001`). ### Verification - Added `HostHeap` unit tests and a multi-adapter D3D12 Debug Layer + `ID3D12InfoQueue` compute dispatch readback test exercising `NumElements == 0` alongside non-empty buffer SRVs/UAVs: - **NVIDIA GeForce RTX 5090** (Debug Layer + InfoQueue): passed (`0` errors) - **AMD Radeon(TM) Graphics** (Debug Layer + InfoQueue): passed (`0` errors) - **Microsoft D3D12 WARP** (Debug Layer + InfoQueue): passed (`0` errors) - `cargo clippy --workspace --all-targets --all-features` and `cargo xtask policy`: passed.
upstream-sync closed this pull request 2026-11-25 01:06:32 +00:00
Marvisak commented 2026-11-25 01:08:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:40:12Z.


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

Zero-element buffer views already become null views in main (within() requires count > 0, commit 4051149c, with its own test).

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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148752746 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1427#issuecomment-7148752746). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:40:12Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. Zero-element buffer views already become null views in main (within() requires count > 0, commit 4051149c, with its own test). 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

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
Marvisak/VIctory!1426
No description provided.