Repository navigation
GPU: a buffer view of no elements is made null instead of removing the device - #4
Merged
Merged
Conversation
…e device Port of Vaximous's a52f612 on fix/zero-element-buffer-views (issue Marvisak#912); it applies as-is. D3D12 treats a buffer SRV or UAV with NumElements 0 as an invalid call and removes the device (DXGI_ERROR_INVALID_CALL), with no debug layer needed. buffer_srv and buffer_uav passed such a title view straight to the host. On the console a view of no elements reads and writes nothing, as the null view the slot now gets does. The new test makes placed buffer views of one and of no elements on the host device: without the change the device is removed with 0x887A0001. Co-authored-by: Vaximous <vaximous@gmail.com> Co-authored-by: openhands <openhands@all-hands.dev>
MagiccConch
marked this pull request as ready for review
November 24, 2026 20:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes (upstream tracking) Marvisak#912.
What changed
One file,
crates/victory-gpu/src/descriptor/host.rs(+54, 11 of them code). Port of Vaximous's commita52f612onfix/zero-element-buffer-views— the fork's file matches its base (ffe310e) and the patch applies as-is.buffer_srv/buffer_uav: a buffer view withNumElements == 0no longer reachesCreateShaderResourceView/CreateUnorderedAccessView; the slot gets a null view and aonce!line records it.buffer_views_of_no_elements_are_nullmakes placed buffer views of one and of zero elements on a host device, asserts the empty slots are null andGetDeviceRemovedReasonstaysS_OK(skips without a host GPU, like the other device tests).Why
D3D12 treats a buffer SRV or UAV with
NumElements == 0as an invalid call and removes the device (DXGI_ERROR_INVALID_CALL,0x887A0001) — no debug layer, empty DRED breadcrumbs. The title hit this right at world entry, appearing random because it depended on shader-cache contents. On the console a zero-element view reads and writes nothing, which is exactly what the null view does. Upstream verification: RTX 4070 Ti (Windows 11) runs that previously died at world entry reach the world with this check; without it, the new test removes the device. Related: Marvisak#635 bounds-checks the same view paths; this covers only the zero-element case.Validation here
cargo check -p victory-gpu --target x86_64-pc-windows-msvc --all-targets --all-features --locked— clean.cargo clippy -p victory-gpu --target x86_64-pc-windows-msvc --all-targets --all-features --locked -- -D warnings— clean.This PR was created by an AI agent (OpenHands) on behalf of the user.