gpu: allow live aliased indices with un-sliced placed vertex streams #2826
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2834"
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 Holastor on 2026-11-26T12:43:07Z.
Summary
Fixes #2714.
Upstream PR #2724 enabled
live_indicesfor direct indexed draws (list_draw_indexed/ slot 13) when the index buffer was an aliased placed buffer, but explicitly restricted draws to those with no vertex streams:std::none_of(tr->srvs.begin(), tr->srvs.end(), [](const Translation::Srv& srv) { return srv.source == 1; })Because of this restriction, any draw referencing vertex streams from
pass.vbfell back to snapshotting indices into upload ring memory at recording time (frame_copy) and slicing the stream via an index scan[low, high], ignoring pre-submission CPU writes to the index buffer.This change:
stream_needs_slicing, which checks whether each referenced vertex stream requires upload ring slicing (unplaced, unaligned, or null placed alias).placed.alias != nullptr),live_indicesis retained,vertex_firststays 0 (no slicing), and the root constantbase_vertexis unbiased (base_vertex - 0).retain_with_recording.tests/startup_direct_index_late_write_check.pyandtests/startup_stream_draw.cppwith placed vertex stream test cases (visible-vb,clipped-vb,late-visible-vb,late-clipped-vb) and an unplaced negative control (late-visible-vb-unplaced) verifying that unplaced buffers correctly fall back to recording-time snapshots and index slicing.Evidence
Commit under test:
a859da17Environment:
Test commands and results:
All 8 tests passed across WARP and hardware backends.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:47:20Z.
Review: COMMENTED
Review of head
a859da17against current main (comment review, no approval).What I checked
stream_needs_slicinginsrc/startup_stubs/d3d12_draw.inlkeeps live indices only when every referenced vertex stream is a live, aligned, non-rejected placed alias. Anything else (unplaced, null alias, bad alignment, size not a multiple of 4, bad slot) still takes the recording-time snapshot and index scan path. Empty streams (SizeInBytes == 0) do not force slicing, which is fine.vertex_firstandvertex_countstay 0, so no stream is sliced, and the root constant isbase_vertex - 0.DrawIndexedInstancedis called with base 0 and the index offset is baked into the live view, so the shader seesindex + base_vertexexactly as before. Consistent.startup_direct_index_late_write_check.pyandstartup_stream_draw.cppadd placed-stream cases (visible-vb,clipped-vb,late-visible-vb,late-clipped-vb) and an unplaced negative control (late-visible-vb-unplaced). The alias-count assertion distinguishes placed from unplaced. Existing direct-index cases are kept.source == 1blanket check sends the vb cases back to the snapshot path, solate-visible-vbwould read the stale index and fail the pixel check.Commands run locally
git diff --check origin/main...HEAD: cleanpython3 tests/docs_links_check.py: okpython3 tests/bidi_controls_check.py: okpython3 -m py_compile tests/startup_direct_index_late_write_check.py: okNext: Win2025 WARP dev + release run on this head; I will post the receipt.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:49:16Z.
Win2025 WARP receipt for head
a859da17.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
a859da170d912725c5439836caaebd7e75cbc9c5:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer -- -j 2):24.62s(configure1.89s)ctest --preset dev -R 'startup_direct_index_late_write' --parallel 3 --no-tests=error --output-on-failure): 2/2 passed (1.78s:startup_direct_index_late_write_warp1.64s,startup_direct_index_late_write_hardware1.63s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer -- -j 2):52.34s(configure1.90s)ctest --preset release -R 'startup_direct_index_late_write' --parallel 3 --no-tests=error --output-on-failure): 2/2 passed (1.91s:startup_direct_index_late_write_warp1.76s,startup_direct_index_late_write_hardware1.76s)sccache: 4/14 hits; wall87.7sAI-assisted; commands listed were executed locally.