startup: allow MRT, depth, and depth-only targets in translated ExecuteIndirect #2409
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2417"
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 stan495 on 2026-11-25T16:06:41Z.
Summary
Allow
X2W_TRANSLATED_INDIRECT_DRAW=1ExecuteIndirectdraws to run with multiple render targets (up to 8 RTVs), colour + depth-stencil, and depth-only (0RTVs + DSV) attachments instead of refusing them beforedraw_translated_indirect.pipeline_for()ind3d12_draw.inlalready builds desktop graphics PSOs matchingpass.target_count,pass.target_formats[0..target_count-1], andpass.dsv_format, andlist_set_render_targetsalready trackspass.targets_single_sampleandpass.depth_view_writable.src/startup_stubs/d3d12_xs_device.cpp:pass.bound_targets[8]andpass.bound_depthinlist_set_render_targets(cleared on each bind).list_execute_indirect, whentranslatedis true, requirepass.targets_bound, at least one colour or depth attachment (pass.target_count > 0 || pass.dsv_format != DXGI_FORMAT_UNKNOWN),pass.viewport_set && pass.scissor_set, andpass.targets_single_sample.src/startup_stubs/d3d12_draw.inl:pass.target0to all bound colour targets (pass.bound_targets[0..target_count-1]) and a writable depth target (pass.bound_depth && pass.depth_view_writable).indirect_refusal_code::read_only_depth_write).tests/startup_indirect_draw_indexed.cpp&CMakeLists.txt:startup_indirect_translated_targets_{warp,hardware}covering 2-target MRT, colour + DSV, depth-only (0RTV + DSV), refusal of zero attachments, and refusal of a sampled texture aliasing RTV 1 (sampled_texture_mismatch).docs/experiments.md:Translated indirect trianglessection with the supported target combinations, aliasing/read-only-DSV rules, and test filter.Verification
cb9259a2(based onupstream/main7092683a)AMD Radeon RX 7900 XTX(driver32.0.32029.2010,XBOX2WINDOWS_ADAPTER=7900) and WARP (Microsoft Basic Render Driver, driver10.0.26100.9818), D3D12 debug layer enabled (0 errors; only the expected benign warning ID 679 when reusing the colour-writing pixel shader for the 0-RTV depth-only fixture case).ctest --preset release --no-tests=error -j 1 -R '^startup_indirect_(translated_(targets|draw|refusal_census)|draw_indexed)' -V-> 9/9 passed, 0 failed, 0 skipped:startup_indirect_translated_targets_warp: PASSstartup_indirect_translated_targets_hardware: PASS (AMD Radeon RX 7900 XTX, debug layer enabled)startup_indirect_translated_draw_{warp,hardware}: PASSstartup_indirect_translated_refusal_census_{warp,hardware,control_warp}: PASSstartup_indirect_draw_indexed_{warp,hardware}: PASSpython -B tests/docs_links_check.py-> PASS (19 Markdown files, 464 links)python -B tests/bidi_controls_check.py-> PASS (1723 tracked files)Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-25T16:08:31Z.
APPROVED. Allows MRT, depth, and depth-only targets in translated ExecuteIndirect. Useful extension.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:22:58Z.
Review: COMMENTED
Review of head
cb9259a2(Linux checks and code reading only; I did not build or run the C++ fixture, and I found no author-posted Windows results for this SHA).What I checked
list_execute_indirect(d3d12_xs_device.cpp ~2663): the translated branch now accepts MRT, colour plus depth, and depth-only. It still needs viewport, scissor, bound targets and single-sample.pass.targets_single_sample(set inlist_targets, ~3172) covers every colour target and the depth resource, so skipping the oldtarget0sample check for translated draws is safe (and avoids a nulltarget0in the depth-only case).list_targets:bound_targets[8]andbound_depthare cleared at the top and filled only after the early returns, so a failed bind leaves no stale pointers.draw_translated(d3d12_draw.inl ~1891, ~2017): the newread_only_depth_writerefusal triggers only when the pipeline writes depth or stencil and the view is not DEPTH_WRITE. The sampled-texture alias check now covers all bound colour targets and a writable depth view. Sampling a read-only depth view is still allowed, which is correct.indirect_refusal_codeentries. The new CTeststartup_indirect_translated_targets_{warp,hardware}is added in the existing backend loop with the same TIMEOUT and SKIP_RETURN_CODE as its siblings, and docs/experiments.md is updated, including the-Rregex.translated-targetsmode renders on the device, then does a fenced readback of the colour targets and compares each pixel to the expected colour. It covers two-target MRT, colour plus depth, depth-only, zero attachments (refused) and an RTV 1 alias (refused withsampled_texture_mismatch). It is a real GPU readback, not a string check.ExecuteIndirect. #2232 and #2333 are merged and cover the base translated path and the census. Open #2411 (census for other refusals) and #2470 (translated compute) touch the same area, so a rebase or CMake/test-file conflict is possible but there is no overlap in behavior.Commands run in a clean worktree of the PR head
python3 tests/docs_links_check.py-> OKpython3 tests/bidi_controls_check.py-> OKgit diff --check origin/main...HEAD-> cleanMinor notes (not blocking)
startup_indirect_translated_(draw|targets)_for the final head are needed before a merge.No bugs found.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-25T19:25:07Z.
Independent Release run at
cb9259a2: all 9 selected tests passed on WARP and RTX 4070, no skips. I found a gap in the depth-only fixture. It reads an unbound color target and expects black, so skipping slot 61 dispatch forMode::depth_onlystill passed both target tests.I added an occlusion query around
ExecuteIndirectin the test-only commit09ef4cf9. The existing fence protects the query readback. Both adapters reported the expected 8 rasterized samples and the full 9-test selection passed. With the depth-only call omitted, both adapters returned 0 and the tests failed. Restoring the call made both pass again. This verifies the draw rasterizes in the depth-only configuration; the fixture uses its existing depth state. Feel free to cherry-pick the test commit into this PR.Windows 11 x64 26300.10075, MSVC 19.52.37029, RTX 4070 driver 32.0.16.2124, in-box WARP 10.0.26100.10068. D3D12 debug layer enabled on both adapters.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T00:51:24Z.
Review: COMMENTED
Review of head
12283d42against currentorigin/main. Code review plus Linux checks only; no Windows run from me on this head. No game or executable result is claimed or verified here.Code (looks correct)
d3d12_xs_device.cpplist_targets:bound_targets[8]andbound_depthare cleared on each bind and filled after the early return, so they matchtarget_countanddsv_format.list_execute_indirect: the newtranslatedbranch only widens the translated path. Non-translated pipelines keep the old single-RTV, no-DSV guard. Skipping thetarget0multisample read for translated draws is safe, becausetargets_single_sampleis checked just above.d3d12_draw.inl: the remainingtarget0uses (around lines 1396 and 2280) are null-guarded, so the 0-RTV depth-only case does not crash.target0check.Test gaps (please address before merge)
ExecuteIndirectcall inMode::depth_onlystill passes. @RonLogic reported this oncb9259a2and offered a test-only commit (09ef4cf9, occlusion query aroundExecuteIndirect) that fails when the call is removed. It is not in this head. Please cherry-pick it or add an equivalent check.read_only_depth_writerefusal (d3d12_draw.inl, around line 1943) has no test:rg read_only_depth tests/finds nothing. A fixture that binds a read-only DSV with depth write enabled and expects the refusal would guard it. Removing the newifblock would currently pass every test.Linux checks run
python3 tests/docs_links_check.py-> 19 files, 507 links, okpython3 tests/bidi_controls_check.py-> 1887 files, okgit diff --check origin/main...HEAD-> cleanCI on this head was still running at review time. The earlier review on
cb9259a2does not cover this head.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T00:51:35Z.
Correction to my review above: it was written against
12283d42, but the PR head moved tob23768ed("verify depth-only indirect draw rasterization with occlusion query") while I was posting. That commit appears to address point 1 (depth-only draw not guarded). I have not re-reviewed or testedb23768ed. Point 2 (no test for theread_only_depth_writerefusal) still stands unless the new commit covers it. Merge stays open until the head is re-reviewed and tested on Windows.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T02:48:34Z.
Review: APPROVED
Independent Windows Release run on this head passed 4/4 with debug layer enabled on WARP and RTX 4060 Laptop. Verified both color attachments, color plus DSV, depth-only rasterization via the occlusion query, refusal of no attachments, and refusal when a sampled texture aliases RTV 1. Existing indexed indirect tests also passed on both adapters. This covers the source-built translated draw path.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-26T02:54:44Z.
Windows CI on merged main now reports C2086 for both
Pass::bound_targetsandPass::bound_depth. #2417 and #2448 added the same declarations and commit the same pair in the successful bind path. I will submit the small integration fix on current main, keeping the common target state for both consumers and the separate trace state. Failing build