startup: bind GPU-backed table buffers for indirect draws #2228
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2236"
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-25T06:53:27Z.
Depends on #2232. Refs #870.
Reuse the translated indirect Draw binding path for table buffers whose complete byte range maps to a recording-owned upload allocation, a unique aliased placed buffer, or a wrapped desktop resource with no separate title backing. The runtime binds a desktop raw SRV and the descriptor's stride. It refuses ambiguous mappings, copied placements with unproven GPU contents, misaligned raw views, out-of-range descriptors, cross-device resources and reuse of the indirect argument resource as an SRV. Deferred guest roots can supply recorded tables to the translated desktop root.
The source-built fixture writes two colours to a default-heap GPU buffer and writes the Draw arguments in another GPU buffer. A view with nonzero offset and stride selects the second colour. A shorter view exposes only its declared range, so the same load reads zero. A non-aliased placement with distinct CPU and GPU data leaves the target clear. The raw descriptor case uses a recording-owned upload allocation and checks refusal when the range crosses that allocation. A matching deferred guest root also produces all eight expected pixels.
Local MSVC Release on Windows 11 build 26200.9974. WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, with the debug layer enabled for the translated draw fixture.
21/21 passed, no skips. AI-assisted. Commands executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T06:55:50Z.
Review: COMMENTED
Review of head
741e2ef7f0(Linux-side review; no Windows run by me).Commands executed locally:
git diff --stat origin/main...HEAD: 6 files, +525/-21 (d3d12_draw.inl, d3d12_xs_device.cpp, list_upload_pages.h, CMakeLists.txt, test, docs/experiments.md)python3 tests/docs_links_check.py: self-test passed, 18 files, 412 links OKpython3 tests/bidi_controls_check.py: 1507 files, no bidi controlsgit diff --check origin/main...HEAD: cleangh pr checks 2236: no CI checks reported on the branch; PR is MERGEABLE, title is neutral, body has no clean-room concerns.Read-through findings (targeted reading of
draw_translated,indirect_table_buffer,indirect_shader_entry,list_execute_indirect,Arena::range):X2W_TRANSLATED_INDIRECT_DRAW) and every unproven case returns a refusal, so default behaviour is unchanged.bytes > desc.Width - offsetafteroffset > desc.Widthcannot underflow;Arena::translateis kept as a wrapper overrange, so existing callers are unchanged; the argument buffer is refused as an SRV; cross-device resources are refused.indirect_table_buffer, upload branch): when a recording-owned upload allocation matches but the view token names anowner, it returns{}silently. The refusal text is the generic "complete GPU-backed table buffer range", so a log reader cannot tell this case from a real range error. Suggest a distinct refusal reason.draw_translatedindirect branch):view.uploadskipsrequire_state. That is right for UPLOAD heap buffers (GENERIC_READ), but a wrapped resource that was previously transitioned by the title would be skipped too if its heap is upload. Please add a short comment or a test line stating that upload-heap buffers never leave GENERIC_READ.draw_dump_afterand the per-shader draw log are skipped for indirect draws. Fine, but the diagnostics budget (32 refusals, 16 records) is static and shared across shaders; worth a line in docs/experiments.md.independent_indirect_entryis cached per Translation; if the target-variant lookup (translation_for_targets) can return a different Translation with differentuds, the cache is per variant, which looks correct. A one-line comment would help.Mutation testing: not done. The touched tests (
startup_indirect_draw_indexed.cpp, cteststartup_indirect_translated_draw_{warp,hardware}) are Windows D3D12 only and cannot build on this Linux host, so I could not run a mutation. A Windows WARP run is needed before Ready; the body cites a local Windows run, which I did not reproduce.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T07:19:30Z.
Review: COMMENTED
Re-review of head
9f3706c1(previous review was on741e2ef7). Linux-side only; no Windows run by me.Commands executed locally:
git diff --stat origin/main...HEAD: 5 files, +255/-39 (d3d12_draw.inl, d3d12_xs_device.cpp, list_upload_pages.h, test, docs/experiments.md). CMakeLists.txt dropped out of the diff after the merge of main.python3 tests/docs_links_check.py: self-test passed, 18 files, 418 links OKpython3 tests/bidi_controls_check.py: 1520 files, no bidi controlsgit diff --check origin/main...HEAD: cleangh pr checks 2236: no CI checks reported; PR is MERGEABLE, title neutral.rg -n -C6 'if \(!view.upload\)'in d3d12_draw.inl,rg -n -i 'GENERIC_READ|upload'in the test,rg -n -i 'refusal|budget'in docs/experiments.md.Status of the two earlier P2 items:
indirect_table_buffer, upload branchif (!owner) return {...}; return {};): a view token that names anownerand matches a recording-owned upload allocation still returns{}, and the caller still reports the generic "complete GPU-backed table buffer range". Same ambiguity as before. Please add a distinct refusal reason, or a comment saying why this case is deliberately folded into the generic text.if (!view.upload) require_state(...)): no comment and no test line stating that upload-heap buffers stay in GENERIC_READ and so need no transition. The test creates its upload buffer in GENERIC_READ (startup_indirect_draw_indexed.cpp:424-425) but does not assert the skip. A one-line comment is enough.New in this head, read-through:
indirect_shader_entrynow accepts astrideud bound to a source-0 kind-0 SRV, and thesrv.kind > 0requirement was dropped fromindependent_indirect_entry. The accepted set is narrow (exact match on source and kind), so I see no P1.Mutation testing: not done. The touched tests are Windows D3D12 only and do not build on this Linux host. A Windows WARP dev+release run is still needed before Ready.
Counts: P1=0, P2=2 (both carried over, unresolved).
AI-assisted; commands listed were executed locally.