Repository navigation
startup: record root CBV addresses for translated draws (slot 42) - #1654
Conversation
Slot 42 stores the title address of a CBV root parameter in root_address, the table a translated shader reads through its root pointer. Adds startup_root_cbv_{warp,hardware} with a bound, an unbound, a null and a wrong-type case.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 109e7dc80c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
AI-assisted; commands listed were executed locally.
|
In the source-built WARP comparison, switching to a different root signature and then back reused the old CBV colour before this fix. 61a55f6 invalidates stored root addresses on a signature change and preserves them when binding the same signature again. The root CBV, address SRV and 1D SRV Release tests passed 6/6 on RTX and WARP with no skips. The slot number is still an inference from the command-list ordering. https://learn.microsoft.com/en-us/windows/win32/direct3d12/using-a-root-signature |
Conflicts resolved keeping both sides: - d3d12_draw.inl: mip comment line, upstream's wording (R0Y00#1630). - d3d12_xs_device.cpp: Pass keeps local compute root state and upstream viewport/scissor flags (R0Y00#1657); local ExecuteIndirect trace (slot 61) and upstream list_root_cbv (slot 42, R0Y00#1654) both kept. - xcrdapi.cpp: local failure tally, RDS5 shift/slice and stream cache kept next to upstream's BCPack census (R0Y00#1622); queue worker is upstream's CreateThread worker (R0Y00#1410), the local tally_failure("exception") moved into fail_entry. - run.ps1: upstream venv python and exit code (R0Y00#1535/R0Y00#1603) with local --fast-exit/--log-repeats. - gfx2hlsl.py image(): local 1D lowering (load, sample, sample_l, a16) kept over upstream's sample-only 1D guard; startup_image_sample_l_check keeps the local 1D SampleLevel expectation, startup_image_3d_check keeps the local 1D assertions plus upstream's cube-dimension refusal. Tests adjusted for local behaviour: startup_run_ps1_check expects the two local debugger arguments, startup_translator_check's StubPipeline has ps_entry_reads, and the coverage check's hand-built Pipeline sets packed_position_vgpr (new in R0Y00#1634).
Change
Command-list slot 42 (
SetGraphicsRootConstantBufferView) now stores the title address for a root parameter that the root signature declares as a CBV, in the sameroot_addresstable that a translated shader already reads for a root pointer (srv N buf root Pin the manifest,d3d12_draw.inl). Until now only the SRV call (slot 44) filled that table, so a translated stage that reads its constants through a root CBV saw address 0 and a null buffer, and the draw was still counted as translated.Rules of the new handler
list_root_cbv:root CBV N ignored ...) for the whole run;pass.root_address[parameter] = 0so a previous binding is not left stale;pass.root_address[parameter] = address.Nothing is forwarded to the desktop list and
srv_boundis not touched (bit 0 means a vertex-fetch SRV is bound).The slot number is derived, not observed: desktop
SetGraphicsRootConstantBufferViewis 38 and the console order sits four above it fromSetDescriptorHeapson (slots 32, 34, 36, 40, 44, 47, 48, 50 and 52 already follow that shift).tools/startup/capture.pynames slot 42 the same way. No title log in this repository exercises it yet. A trace of one frame (X2W_D3D12_TRACE_FRAME) showing slot 42 with a root-parameter index and a title address would confirm it.Overlap: no hunk touches the regions changed by #1469, #1567 or #1641. #1441 adds list slots in the same registration block, three lines away from the one added here.
Refs #870.
Verification
Linux checks at commit
109e7dc8:git diff --check: clean.python3 tests/docs_links_check.py: self-test passed, 16 Markdown files and 348 links.python3 tests/bidi_controls_check.py: self-test passed, 1278 tracked files, no bidirectional controls.python3 -m py_compile tests/startup_root_cbv_check.py: ok.Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP) at commit
109e7dc8:--preset dev):cmake --build --preset dev --target d3d12_xs_shim startup_stream_consumer startup_stub_consumer d3d12x_graphics_list_check -- -j 6: passed (25.38s).ctest --preset dev -R '^(startup_root_cbv_warp|stream_root_srv_warp|startup_stream_draw_warp|startup_stubs|d3d12x_graphics_list_warp|startup_cb_blend_warp|startup_address_buffer_srv_warp)$' --parallel 4 --no-tests=error --output-on-failure: 7/7 passed (3.32s, includingstartup_root_cbv_warp3.00s)./O2(--preset release):cmake --build --preset release --target d3d12_xs_shim startup_stream_consumer startup_stub_consumer d3d12x_graphics_list_check -- -j 6: passed (38.36s).ctest --preset release -R '^(startup_root_cbv_warp|stream_root_srv_warp|startup_stream_draw_warp|startup_stubs|d3d12x_graphics_list_warp|startup_cb_blend_warp|startup_address_buffer_srv_warp)$' --parallel 4 --no-tests=error --output-on-failure: 7/7 passed (3.49s, includingstartup_root_cbv_warp3.19s).list_typed[42]insrc/startup_stubs/d3d12_xs_device.cppon Windows Server 2025 (--preset dev) and ranctest --preset dev -R '^startup_root_cbv_warp$' --output-on-failure: failed as expected (boundread00000000instead offfff00ff), then restored cleanly.Not run:
startup_root_cbv_hardware(the Windows test node only has WARP; skips with 77 without a hardware adapter).Evidence and follow-up
New test
tests/startup_root_cbv_check.pyreusesdraw_texturefromstartup_address_srv_check.py: the translated pixel stage is replaced by a hand-written stage that returnsasfloat(constants.Load4(0))fromByteAddressBuffert0, bound with the manifest linesrv 0 buf root 0. The consumer (startup_root_cbv.cpp, selected byX2W_TEST_ROOT_CBV) declares root parameter 0 as a CBV and, before one draw, does one of:boundunboundnullwrong_typeroot CBVlog lineThe right half keeps the clear colour in all four modes.
Assumptions: the console uses the desktop argument order for this call (parameter in the first argument, GPU address in the second), as slots 40 and 44 do. The same gap exists for root UAV (slot 46, derived the same way) and the single-constant call (slot 38); both are left out to keep this to one behaviour.
Checklist
AI-assisted; commands listed were executed locally.