Repository navigation
startup: allow MRT, depth, and depth-only targets in translated ExecuteIndirect - #2417
Conversation
|
APPROVED. Allows MRT, depth, and depth-only targets in translated ExecuteIndirect. Useful extension. |
tedin7
left a comment
There was a problem hiding this comment.
Review of head cb9259a (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
- Scope: 5 files (d3d12_draw.inl, d3d12_xs_device.cpp, tests/startup_indirect_draw_indexed.cpp, CMakeLists.txt, docs/experiments.md). Additive, limited to the translated ExecuteIndirect path. Non-translated indirect graphics keep the old one-target, no-depth check.
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.- Sibling census: the new refusal code sits next to the other
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. - Test: the new
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. - Duplicates: searched
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-> clean
Minor notes (not blocking)
- The read-only-depth refusal and the depth-only success path have no mutation I could run on Linux. The Windows WARP and hardware runs of
startup_indirect_translated_(draw|targets)_for the final head are needed before a merge. - The branch is 27 commits behind main. Please keep any Windows results tied to the final head SHA.
No bugs found.
AI-assisted; commands listed were executed locally.
|
Independent Release run at I added an occlusion query around cmake --build --preset release --target startup_indirect_draw_indexed xmem_shim --parallel 4
ctest --preset release --no-tests=error -j 1 -R '^startup_indirect_(translated_(targets|draw|refusal_census)|draw_indexed)' --output-on-failureWindows 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. |
…direct-targets # Conflicts: # CMakeLists.txt # src/startup_stubs/d3d12_xs_device.cpp # tests/startup_indirect_draw_indexed.cpp
tedin7
left a comment
There was a problem hiding this comment.
Review of head 12283d42 against current origin/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.- The alias check over all bound colour targets and a writable depth target is a sound extension of the old
target0check.
Test gaps (please address before merge)
- The depth-only fixture does not prove the draw happens. It reads an unbound colour target and expects black, so dropping the
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. - The new
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-> clean- Mutation runs of the new test need a Windows build and were not done by me.
CI on this head was still running at review time. The earlier review on cb9259a2 does not cover this head.
AI-assisted; commands listed were executed locally.
|
Correction to my review above: it was written against AI-assisted; commands listed were executed locally. |
R0Y00
left a comment
There was a problem hiding this comment.
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.
|
Windows CI on merged main now reports C2086 for both |
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)