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

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

@⁠fuzeofficlal on GitHub · 2026-11-24 17:57 UTC · original
fuzeofficlal:fix/zero-element-buffer-views-912 → main · +636 −25 · 1 files · 1 commits · closed without merging

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.
**@⁠fuzeofficlal** on GitHub · 2026-11-24 17:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/1427) `fuzeofficlal:fix/zero-element-buffer-views-912` → `main` · +636 −25 · 1 files · 1 commits · closed without merging 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.
D3D12 rejects CreateShaderResourceView and CreateUnorderedAccessView on a non-null buffer when NumElements is 0, removing the host device with DXGI_ERROR_INVALID_CALL (0x887A0001). Return None from buffer_srv and buffer_uav with a once! warning so zero-element console buffer views bind conformant null buffer descriptors instead.

Add HostHeap unit tests and a multi-adapter D3D12 debug-layer compute dispatch readback test.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:31:19 +00:00
github-bot closed this pull request 2026-11-26 04:31:19 +00:00
Author
Owner

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

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.

**@⁠Marvisak** on GitHub · 2026-11-25 00:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1427#issuecomment-7148752746) 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

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