GPU: unbind vertex buffer slots for null view arrays #681
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/681"
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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T06:43:44Z.
Problem
The vertex-buffer command turns a null view pointer into an empty slice. With a nonzero count this leaves the previous buffers bound in those slots. The D3D12 binding spec defines a null view pointer and a zero-sized buffer view as unbound. D3D12 resource binding specification
Change
Clear the recorded slots covered by the null binding. The ordinary draw path materializes their zero-sized views.
Verification
StartSlot=1, NumViews=1, pViews=null. On RTX 5090 and WARP, the baseline leaves the old green component in all 16 pixels. The patch reads back the expected[0.5, 0, 0.25, 1]in all 16, with slot 0 still contributing red.All input data was synthetic.
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T06:45:46Z.
Review: APPROVED
LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. cargo test -p victory-gpu passed cleanly (43 passed, 1 benchmark ignored). Clearing recorded vertex buffer slots when iews is null conforms strictly to the D3D12 resource binding specification.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T06:55:01Z.
Review: COMMENTED
Static review only (Windows/D3D12 code):
VertexViewderivesDefault(address=0, size=0, stride=0), which is the unbound state, andclear_vertex_buffersresets exactly the[start, start+count)slots — consistent with the D3D12 binding spec quoted in the PR.items()already maps a null pointer to an empty slice, so before this change a nullviewswith nonzerocountsilently did nothing (previous buffers stayed bound) — the bug is real.views.is_null()branch at the FFI boundary is the right place;set_vertex_bufferswith an empty slice evidently doesn't clear, so the explicit clear is needed.Minor:
clear_vertex_buffersuses.skip(start as usize).take(count as usize)on the fixed-sizevertexarray — if a title passesstart + countbeyond the array length, the tail is silently ignored rather than wrapped; same behavior as the existingset_vertex_bufferspath presumably, but worth a glance.