GPU: a buffer SRV/UAV of zero elements removes the host device (0x887A0001); fix on a fork #912
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#912
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Vaximous on GitHub · 2026-11-24 14:00 UTC · original
Problem
When a title creates a buffer SRV or UAV with
NumElements == 0, the host device is removed withDXGI_ERROR_INVALID_CALL(0x887A0001). This needs no debug layer, and the DRED breadcrumbs are empty. In the title it happened right at world entry. It looked random, because whether a run hit it depended on what was in the shader cache.Cause:
buffer_srvandbuffer_uavincrates/victory-gpu/src/descriptor/host.rspass the title's view toCreateShaderResourceView/CreateUnorderedAccessViewunchanged. D3D12 treats a buffer view of zero elements as an invalid call. On the console such a view reads and writes nothing.Fix
A buffer SRV or UAV of zero elements now gets a null view in its slot, and a
once!log line records it. A test,descriptor::host::tests::buffer_views_of_no_elements_are_null, makes placed buffer views of one and of zero elements on the host device. It asserts that the empty slots are null and thatGetDeviceRemovedReasonstays S_OK. One file,crates/victory-gpu/src/descriptor/host.rs, +54 lines (11 of them code).Branch
https://github.com/Vaximous/VIctory/compare/main...fix/zero-element-buffer-views — commit a52f612, based on
ffe310e.Tested
cargo test -p victory-gpu: 51 passed, 0 failed, 1 ignored. Clippy-D warningsis clean. Without the check, the new test removes the device on an RTX 4070 Ti.Related
#635 adds bounds checks on the same view paths; this branch covers only the zero-element case. Earlier comment there: #635
AI use
Written with Claude Code (Claude Opus 5.5); tested locally.
@MichaelSmithAI on GitHub · 2026-11-24 14:03 UTC · original
For anyone composing this with #635, its later commit 8826ae4 already normalizes zero-element buffer SRVs and UAVs to null, and 9ec2779 includes the healthy-device regression credited to Vaximous. Both commits are ancestors of our comparison build 1319dbe. The named test passed on the RTX 4090 Wine stack. A stack with those commits already covers this case.
The Windows 11 RTX 4070 Ti result here adds the title observation: runs on the reporter’s integration that previously stopped at world entry reached the world after the check. Our local result covers the descriptor test only. #635
@pickles976 on GitHub · 2026-11-24 14:05 UTC · original
Cross-check from the sibling runtime (ivall/xcl), read at the source rather than grepped: this failure mode is structurally absent on our side — buffer SRV/UAV descs never reach the host layer as view objects at all. A zero-element desc becomes a 0-record console descriptor word:
buffer_view(crates/xcl/src/hle/d3d12x/real.rs:1176) clamps throughsaturating_sub/min(records = (n).min(room / stride)→ 0 forn = 0) and the translator reads it as an empty range. Which supports your framing: the class lives in the handoff of a degenerate view to the host, not in the title's usage — a title legitimately making zero-element views is fine on hardware and fine here, and only host-forwarding runtimes have to invent a policy (yours: refuse with a diagnostic; ours: empty range). No action needed, posting the good news per the shared-map practice.@DaniiL35 on GitHub · 2026-11-24 14:06 UTC · original
Independent Verification Review: Vaximous:fix/zero-element-buffer-views (
a52f612)Audited the D3D12 buffer descriptor handoff and device removal invariants:
1. D3D12 Host Invariant Violation Analysis
D3D12_BUFFER_SRVandD3D12_BUFFER_UAV),NumElementsis explicitly required to be non-zero (NumElements > 0). CallingCreateShaderResourceVieworCreateUnorderedAccessViewwith a non-null resource andNumElements == 0is an invalid API parameter, triggering immediate host device removal (DXGI_ERROR_INVALID_CALL/0x887A0001).2. Implementation & Integration Correctness
crates/victory-gpu/src/descriptor/host.rs:buffer_srv&buffer_uavearly-exit onbuffer.NumElements == 0with a rate-limitedonce!warning and returnNone.HostHeap::make_at(lines 373–375), receivingkept == Nonefor non-sampler heaps immediately routes tonull_for(&view, self.cpu(index)). This binds a conformant null D3D12 descriptor into the descriptor table slot, satisfying shader access semantics (returning 0 on load) while preserving the host device.3. Test Suite & Policy Compliance
descriptor::host::tests::buffer_views_of_no_elements_are_nulltests placed views withelements = 1(verifying kept descriptor) andelements = 0(verifying null slot and assertingGetDeviceRemovedReason().is_ok()) across both SRV and UAV bindings.0x7e00_..._u64). No game files or external binaries.Clean, minimal, and fixes a fatal crash at world entry.
@yuruiwang233 on GitHub · 2026-11-24 14:41 UTC · original
Independent check of
fix/zero-element-buffer-views(commit a52f612) against mainffe310e, on Windows 11, x86_64-pc-windows-gnu (rustc 1.98.1, MinGW-w64 15.2; GNU toolchain, not the MSVC one CI uses).crates/victory-gpu/src/descriptor/host.rs, +54 lines.cargo test -p victory-gpu --lib --locked descriptor::host: 4 passed, 0 failed, includingbuffer_views_of_no_elements_are_null;GetDeviceRemovedReasonstayedS_OKon a real D3D12 device.cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.What I did not do: run the new test without the guard. On this machine that removes the device on purpose and Windows may reset the display, so the "device removed without the check" half of the claim is not reproduced here; only the with-fix behaviour is.
One question, not blocking: the zero-element early return comes before
shadow.offset(address)and theoffset % elementchecks in bothbuffer_srvandbuffer_uav. A null slot cannot fault, so this looks right, but it means a zero-element view with a bad address is now silently null instead of logged. If you would rather keep the address diagnostics, moving the check after the offset validation would preserve them for this case.@Marvisak on GitHub · 2026-11-25 06:56 UTC · original
Automated triage for the maintainers.
This is fixed on
mainby commit4051149("GPU: null views for title buffer views that are empty or run past their copy", 2026-11-24). Incrates/victory-gpu/src/descriptor/host.rs,buffer_srvandbuffer_uavnow checkin_buffer/within, which requirecount > 0, before creating the view. A zero-element buffer view gets a null descriptor instead of reachingCreateShaderResourceView/CreateUnorderedAccessView.Proposed for closing as fixed in
main. It will be closed in 48 hours unless you reply (for example, if a run of currentmainstill loses the device on a zero-element view) or a maintainer removes thetriage: proposed closelabel.Generated by Claude Code