startup: record root CBV addresses for translated draws (slot 42) #1647
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1654"
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 tedin7 on 2026-11-24T16:17:48Z.
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.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T16:33:12Z.
Review: COMMENTED
💡 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
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".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T16:36:50Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T16:28:36Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
109e7dcℹ️ About Codex in GitHub
Your 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.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T16:44:21Z.
In the source-built WARP comparison, switching to a different root signature and then back reused the old CBV colour before this fix.
61a55f63invalidates 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-signatureImported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T16:33:13Z.
Code review location:
docs/startup-runtime.md; line 150This adds a public root-CBV binding capability, but documents it only in
docs/startup-runtime.md, leaving bothREADME.mdanddocs/experiments.mdunchanged.AGENTS.mdrequires a README or experiment-note update when a public capability changes, andCONTRIBUTING.mdplaces reproduction details indocs/experiments.md. Update the relevant capability entry and add the fixture's build/test commands and synthetic-only scope so contributors can discover and reproduce the new support without consulting the commit message.AGENTS.md reference: AGENTS.md:L193-L194
Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T16:36:50Z.
Code review location:
docs/startup-runtime.md; line 150Fixed in
49d15fc240: added a "Startup root constant buffer views" section todocs/experiments.mdwith the synthetic-only scope, the fixture/check files, and the build/ctest commands. Ran locally:git diff --check,tests/docs_links_check.py,tests/bidi_controls_check.py,x2w_pipe.py preflight. AI-assisted; commands listed were executed locally.