Bind translated vertex streams to bounded live placed buffers #1309
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1316"
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 R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T07:45:41Z.
Refs #874, #1305 and #1307.
Slot 133 already records each placed resource. The translated vertex-stream path previously read the supplied CPU address into a transient upload ring during command recording. For a live aliased GPU buffer, that changes what a draw sees if the application updates a valid vertex before queue submission.
Slot 48 now resolves the full guest vertex address and the declared view length against the existing resource records for the command list's creating device. Final release retires the active placement. Eligible views bind the desktop resource as a bounded raw SRV. A declared range spanning the registered end or multiple placements is rejected before staging. The translated draw uses its existing single render device and descriptor heap and checks list/heap ownership. CPU-backed committed fallbacks still stage their data.
The new EXE/DLL fixture opens two CPU-visible buffers with guest bases 1 TiB apart, reads the last valid DWORD, and changes both words after recording and before submission. The GPU sees the new values. An eight-byte view starting at the last DWORD is rejected; the shader reads only offset zero of a null descriptor. After a fence, the EXE releases the high resource, registers a larger buffer at the same address, and checks the new endpoint as well as the overlapping original endpoint. Both passes also verify the low range.
Windows 11 26200.9974, MSVC x64 Release, debug layer off, candidate
fc547dd7. RTX 4060 Laptop driver 32.0.16.1656 and Microsoft WARP 10.0.26100.9818 each returned all 64 expected RGBA pixels. Ten tests passed, zero failed, zero skipped.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T07:51:58Z.
Review: COMMENTED
Peer review at commit
fc547dd7c38e7d3cd66b237ce0715ba1e6f8849f:Checks
git diff --check origin/main...HEAD: passedtests/docs_links_check.py: passed (16 Markdown files, 289 links)tests/bidi_controls_check.py: passed (1092 tracked files)--preset dev):cmake --build --preset dev --target startup_stream_consumer -- -j 6(27.13s),ctest --preset dev -R '^startup_placed_vertex_warp$' --parallel 4 --no-tests=error --output-on-failure: 1/1 passed (0.74s)/O2(--preset release):cmake --build --preset release --target startup_stream_consumer -- -j 6(38.53s),ctest --preset release -R '^startup_placed_vertex_warp$' --parallel 4 --no-tests=error --output-on-failure: 1/1 passed (0.86s)Findings
src/startup_stubs/d3d12_xs_device.cpp(device_place_resource_x):note_resource(w, desc, desc->Width, aliased ? Placement::aliased_buffer : Placement::copied_buffer, self)registersPlacementanddesc->Widthunconditionally, removing the priordesc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER ? desc->Width : 0check. If a placed non-buffer resource (e.g. a 2D texture) is created at an address that overlaps a vertex buffer view,placed_vertex_viewwill treatdesc->Width(pixel width) as a byte extent, andbuffer_viewcould attemptCreateShaderResourceViewwithD3D12_SRV_DIMENSION_BUFFERon a non-buffer resource. GatingPlacement(andbytes) ondesc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFERwould prevent non-buffer placements from enteringplacement_index.src/startup_stubs/d3d12_capture.inl(retire_placement):group.max_widthis not shrunk when a placement is retired; this is safe as a conservative upper bound (since the loop stops atit->first < end), though retiring an unusually large buffer leavesmax_widthwide for group 1 (> 64 KiB).Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T07:54:27Z.
Updated in
a0e6ca94. Slot 133 now publishes the resource record and address index under one scope-held lock. If either allocation fails, the caller receives E_OUTOFMEMORY and a null output. Existing placements remain usable, and the same guest address can be retried.The checked-in startup_placement_alloc test failed both allocations in turn and verified rollback, immediate lock acquisition, and retry. Windows Release ran 11 tests with 11 passes and zero skips:
I also injected each failure separately in a local test-only shim and called slot 133 through its normal vtable. Both the RTX 4060 Laptop (32.0.16.1656) and WARP (10.0.26100.9818) returned E_OUTOFMEMORY and cleared a non-null output sentinel. The same-address retry then matched all 64 expected pixels in each of the four runs. Windows 11 build 26200.9974, debug layer off.