D3D-448-GRAPHICS: graphics root arguments in the console layout, mesh shaders through a window #974
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!974
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/974/head"
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?
@iFeyz on GitHub · 2026-11-24 16:07 UTC · original
iFeyz:feat/d3d448-graphics-root-layout→main· +354 −41 · 15 files · 7 commits · merged 2026-11-25 03:00 UTCClaimed in the coordination issue as: D3D-448-GRAPHICS (#14)
What and why
The graphics bind point still laid root arguments out with
pack()(from s0, two dwords per table), while the consolestarts them at s8 for VS/PS/GS with one dword per table (census in
docs/d3d12_vulkan.md3.5, and @DadaCap's liveretail measurement in #14, comment 7131556366: the VS of a textured draw reads its tables at s8/s10, the PS at s9).
So on the retail frame loop no root argument reached a graphics shader. Compute already used the console layout
(D3D-448,
7c225260); graphics was held back because a mesh shader (s16) and a pixel shader (s8) share onepush-constant block. This adds the per-stage window that was missing and switches graphics over.
tools/rdna2spirv.py):user_data_dword()— a mesh shader loads s16..s31 from push dwords 8..23(root dword k sits at push dword 8 + k for every graphics stage), s8..s15 (below its base, not root data) as 0,
s0..s7 unchanged. VS/PS/GS/CS are unchanged (SGPR i = push dword i). The index records
"root_window": {"sgpr": 16, "dword": 8}on mesh shaders.CreateRootSignaturebuilds the graphics layout withpack_stage(Stage::Vertex)and checksStage::Mesh(RootArgumentLayout::mesh_ok);address()writes a table as one dword at both bind points;DispatchMeshwith a signature past the 16-dword mesh window invalidates the list; a mesh PSO whose mesh shaderhas no
root_windowin the index (translated before this) is refused with a log line asking for the shaders stage.their tables as one 32-bit dword from s8 (a short prologue rebuilds the 64-bit pair with a zero high half, as game
shaders do;
ps_m15/vs_m15rewritten sinces_getpc_b64must stay first).docs/d3d12_vulkan.md3.5 and the CreateRootSignature bullet, the user-data row ofdocs/design.md,d3d12_com.handroot_signature.hcomments.Retail evidence: @DadaCap's
boot-prototypebranch (not for merge) switches the graphics layout to the samepack_stage(Stage::Vertex)when its title window is active, and with it the title's first-run menu appears on screen(@DesertGamer, RTX 5070, #14 comment 7134166197). This PR makes that layout unconditional, with tests, and adds what
the prototype does not have: the mesh window (there a mesh shader still reads its s16.. from push dword 16 while the
arguments sit at 8..) and the refusals for a signature or a mesh shader the window cannot serve.
Compatible with the spill block of ROOT-SIG-SPILL-MODEL (@djrolfes, #14 comments 7135596787 / 7135760764): every
graphics stage, mesh included, still reads s0..s7 from push dwords 0..7, so the block pointer in
s[0:1]can bewritten there for graphics as it will be for compute.
Open, not guessed: what a mesh shader reads in s8..s15 (it now reads 0).
python -I tools/user_sgpr_census.py <spirv/index.json> --base ms=16on a corpus lists any read below s16 — a run from someone with the package wouldsettle it. Visibility is still not modelled (D3D-318 measured one block in root order for VS/PS).
Coordination: touches
CreateRootSignatureandaddress()next to ROOT-SIG-SPILL-MODEL (@djrolfes, spill areafor compute);
pack_stageand the spill refusal are unchanged here, so either rebases cleanly on the other. If#424 (indirect mesh dispatch) lands, its path should check
mesh_oklikeDispatchMeshdoes.Tested
python -I scripts/run_semantic_tests.py tests/semantic— 470 files, 6,147 tests, 1 file failed:test_image_cube_store_glc, the WindowsLLVM_MCpath split reported as TEST-CUBE-WINPATH (claimed byTimIdle; that file and the code it tests are untouched here). New
tests/semantic/test_ms_root_window.py(4 tests: the dword mapping, a mesh shader as MeshEXT and with--mesh-computerun by the CPU interpreter, no window on other stages); it fails onmain.ctestonmain1504c1af+ this: 301 of 305 pass. The 4 failures are the sameas on
mainhere (d3d12_clear,d3d12_execute_indirect_validation,d3d12_texture_tiles,d3d12_pipeline_library_host, all already reported in #14);vk_queue_query_syncis flaky here onmaintoo.d3d12_draw_test,d3d12_translated_draw_test(M1.5),d3d12_m2_textured_test,d3d12_m2_formats_test,d3d12_m3_frame_test,d3d12_mesh_test,d3d12_geometry_test,d3d12_depth24_draw_testandd3d12_bundle_testrun on the GPU and match pixel-exact.d3d12_mesh_testadds the two refusals;root_signature_testadds the graphics-window cases.scripts/check_no_game_data.pyon every changed file,tests/test_docs_links.py,tests/test_text_write_line_endings.py,python -m compileall -q make_game.py tools tests.it would show whether the black frame moves.
GPUs tested: AMD Radeon RX 9070 XT (RDNA4), AMD Windows driver 32.0.32029.2010 (Vulkan 1.4.359), Windows 11 26200
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.@madhyn on GitHub · 2026-11-24 16:31 UTC · original
Tested cherry-picking
5fdd6abbconto our local frame-loop stack (Wine 11.22, RTX 3060 Ti, retail 1.0.2.1).Before
#974,CreateRootSignaturesucceeded on the title's startup root signatures (loggingroot signature usable for graphics only: root parameter 8 does not fit in the user SGPRs from s4 (spill array not modelled)) and the run reached the frame loop (1,675 PresentX okin 60s).With
5fdd6abbcapplied,CreateRootSignaturenow refuses one of the startup root signatures:[rt] d3d12: root signature refused: root parameter 8 does not fit in the user SGPRs from s8 (spill array not modelled) (compute: root parameter 8 does not fit in the user SGPRs from s4 (spill array not modelled))followed immediately by an unhandled C++ exception (
0xe06d7363, exit 99) before reaching the frame loop.(Note: it also logged
root signature too large for a mesh shader's root window: root parameter 2/5/7 does not fit in the user SGPRs from s16on earlier root signatures.)AI-assisted: yes
@iFeyz on GitHub · 2026-11-24 16:57 UTC · original
@madhyn thank you, that is exactly the run this needed. Fixed in
74e55acfb: a root signature past the console's inline graphics window (24 dwords from s8) is no longer refused. On the console such a signature goes to the argument block behinds[0:1], which is modelled for compute only so far (ROOT-SIG-SPILL-MODEL, #1009); until it is for graphics, the graphics bind point keepspack()'s layout for that signature (from s0, two dwords per table), which is whatmaindoes today, so no signature is worse off than without this PR. The log line is nowroot signature past the console's graphics window (...): graphics keeps the PC layout from s0 ..., and a mesh shader still refuses such a signature.d3d12_mesh_testcovers a 30-constant signature (past both the graphics and the compute window): created,DispatchMeshwith it invalidates the list. Fullcteston an RX 9070 XT: 301/305, the same four failures as onmain.If you can run the same cherry-pick of the new head on your stack, the question is whether it reaches the frame loop again, and how the PresentX / draw counts compare with your run before #974.
@madhyn on GitHub · 2026-11-24 17:22 UTC · original
Re-tested with
5fdd6abbc+74e55acfbcherry-picked onto the same local frame-loop stack (Arch Linux, Wine 11.22, RTX 3060 Ti, retail 1.0.2.1; note: does not yet includeRT-TITLE-HOST-REGION).CreateRootSignatureis no longer refused:74e55acfblogsroot signature past the console's graphics window (root parameter 8 does not fit in the user SGPRs from s8 (spill array not modelled)): graphics keeps the PC layout from s0...and reaches the frame loop again (50,468 CreatePipelineState ok,0 failed).#974:#974(60 s timeout,EXIT=124):1,675 PresentX ok,5,020 DrawInstanced,3,350 ExecuteCommandLists ok(0 failed).5fdd6abbc+74e55acfb(EXIT=3):2 PresentX ok,2 DrawInstanced,6 ExecuteCommandLists ok(0 failed),0 DispatchMesh, then stops at the title'sint3(0x142474606/0x80000003) right after#62740 XboxID3D12CommandQueue::Slot31 unsupported.AI-assisted: yes
@iFeyz on GitHub · 2026-11-24 18:11 UTC · original
@madhyn thank you, that is a clear regression on your stack and the counts make it easy to follow.
One thing that may narrow it: the
int3you stop at (exe+0x2474606) is the same one @DesertGamer reaches on DadaCap'sboot-prototype, at 77–90 s, with and without #974 (RTX 5070, Windows, #14 comment 7138889766). Your run before #974 was cut at 60 s, so it may simply not have got there yet. What #974 changes on your stack would then be how soon the title gets there (2 presents instead of 1,675+), not where it stops.To compare both layouts without cherry-picking twice,
c170c08dfaddsLEONIDA_GRAPHICS_ROOT_LAYOUT=pc(diagnostic). It gives every graphics root signature the layout used before #974 (from s0, two dwords per table) in the same build. Mesh draws are refused in that mode, and compute is unchanged.d3d12_mesh_testchecks both sides.If you have time for another pair of runs on the same build, with and without the variable, these would tell the cases apart:
pcrun reaches the sameint3when given 120 s or more;VK_ERROR_DEVICE_LOST/ device-lost / fence-timeout line before the stop in the console-layout run;[d3d12-trace]call names beforeSlot31 unsupported(names only).My working guess, not checked: with the console layout the VS/PS read the title's real tables from s8, where before they read whatever
pack()had put there. A draw that now does real work could fault the GPU or write data the title checks right after its first frames. A device-lost line in (2) would point that way. If (1) shows thepcrun also stopping at thatint3later, the layout only moves the title faster to a stop that exists either way.@iFeyz on GitHub · 2026-11-24 18:13 UTC · original
One more line worth copying from that run, if you can:
b2da1c0admakes the fallback print the start-up signature's size per shader visibility, counts only, e.g.Why it matters: per
root_spill_censusno VS or PS readss[0:1]as an address, so graphics shaders never read a spill array. If the per-stage sums come out at 24 or less, the 29–32-dword signature fits each stage on the console because a parameter only takes SGPRs in the stages it is visible to. Then the fix is to model visibility, not a spill block, and the fallback goes away.@madhyn on GitHub · 2026-11-24 18:25 UTC · original
Ran the A/B comparison on the same build (
b2da1c0adcherry-picked onto our local frame-loop stack, Arch Linux, Wine 11.22, RTX 3060 Ti, retail 1.0.2.1; noRT-TITLE-HOST-REGION):int3(0x142474606/0x80000003) right after#62740(2 PresentX ok,2 DrawInstanced,6 ExecuteCommandLists ok).LEONIDA_GRAPHICS_ROOT_LAYOUT=pc(130 s timeout): reaches the full 130 s limit (EXIT=124, noint3, no exception) with4,252 PresentX ok,12,749 DrawInstanced,8,504 ExecuteCommandLists ok, and passesSlot31 unsupportedtwice (#68087,#80138).VK_ERROR_DEVICE_LOST/device lost/ fence-timeout lines in the console-layout log (note:RT-DEVICE-LOST-LOG#980 is not in this build).[d3d12-trace]calls beforeSlot31 unsupportedin console-layout:#62727–#62739are allID3D12Device2::CreatePipelineState ok, followed by#62740 XboxID3D12CommandQueue::Slot31 unsupportedand theint3.b2da1c0ad):AI-assisted: yes
@iFeyz on GitHub · 2026-11-24 18:53 UTC · original
@madhyn thank you, that settles both questions.
Visibility: ruled out. Both start-up signatures (25 and 30 dwords) have every parameter visible to every stage, so they do not fit any stage by visibility.
What stops your run: read together with @DesertGamer's finding in #14 (the
int3at+0x2474606is the title's answer to a fence that readsUINT64_MAX, i.e. a lost device the layer does not notice without #1028), the A/B says that with the console layout the draws now read the title's own tables, and on your stack one of them faults the GPU right after the first frames. With the PC layout they read the wrong dwords and do nothing the GPU minds, so the title keeps presenting. On DadaCap'sboot-prototype, which also lays graphics out from s8, the same layout runs 76–90 s on DesertGamer's RTX 5070 before a later fault. So #974 is what exposes the fault, and the prototype carries something your stack does not. @DadaCap's slots 70/71 descriptor writes andRT-TITLE-HOST-REGIONare the first candidates. A run with #1028 (and #980) on your console-layout build would show which resource faults.One change from your numbers (
00fc23b9a): those 25/30-dword signatures no longer fall back to the PC layout. On the console, only the parameter that does not fit and the ones after it go to the argument block behinds[0:1], and no VS/PS/GS of 1.0.2.1 readss[0:1]as an address (root_spill_census). So the inline part is now laid out from s8 like every other signature, and the rest stores nothing (rt::rootsig::Spill::block, logged once; compute still refuses a spill until #1009). Before this, shaders bound with those two signatures read a shifted layout. It is unlikely to change your stop (those signatures were PC-laid in both of your runs), but it removes the last mixed layout. The visibility log line is gone, andLEONIDA_GRAPHICS_ROOT_LAYOUT=pcstays as the diagnostic switch.@madhyn on GitHub · 2026-11-24 19:03 UTC · original
Tested
00fc23b9astacked with #980 (RT-DEVICE-LOST-LOG) and #1028 (RT-DEVICE-FAULT-INFO) on the same local frame-loop stack (Arch Linux, Wine 11.22, RTX 3060 Ti, retail 1.0.2.1; noRT-TITLE-HOST-REGION/ noboot-prototype):Confirmed your hypothesis — the device is indeed lost right before
queue slot 31and the0x142474606int3, andVK_EXT_device_faultreports an invalid read in the0xe7...title-memory range:(Also note
list slot 70was called right before with0xe78a614420/0xe75dc4f880/0xe78a5d44e0.)AI-assisted: yes
@iFeyz on GitHub · 2026-11-24 19:42 UTC · original
@madhyn thank you, that closes the question: with the console layout the first draws read through the title's own tables and the GPU faults on a read in the
0xe7…title-memory range, an address that stack does not map for the GPU (noRT-TITLE-HOST-REGION, noboot-prototypearena rebasing). So #974 makes the shaders read the right arguments. What they point at needs the title-memory side, which DadaCap'sboot-prototypealready carries (and which explains why the same layout runs there). The clean-mainstop you saw at0x14247af2dright after slots 127 and 20 is the earlier span-check assert measured in #14, not a #974 effect.Unless someone sees a reason otherwise, I will leave #974 as it is: the layout matches every measurement we have, and it should land with or after the title-memory work.
@ohshitwaddup on GitHub · 2026-11-25 01:12 UTC · original
I rebased these 6 commits onto current
mainlocally to find out what a rebase actually costs you. It's two conflicts, both mechanical — here they are so you don't have to rediscover them. I am deliberately not pushing a branch:mainis moving at ~15 commits/hour (136 in the last 6h), so any branch I push is behind before you read this. This note is structural and won't go stale; the branch would.Both conflict points are still present in
mainatb4b7756e, so they will recur on any rebase.1.
runtime/shims/d3d12_com.cpp→DispatchMeshmainrefactored the viewport test into a helper (any_nonempty_viewport()), and your commit adds themesh_okwindow guard at the same spot. Keep both — the guard first, the helper second:Your version's hand-rolled
!(viewport_.width > 0) || !(viewport_.height > 0)is superseded byany_nonempty_viewport(), which now covers the multi-viewport arrays.2.
runtime/test/d3d12_mesh_test.cpp— two unrelated tests collideNot a real conflict:
maingained theDISPATCH_MESHcommand-signature test (from #377 / #1066 —D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_MESH, 12-byte stride, short stride refused) and your commit adds thewide_root_signaturetest, and both land between the same twoEXPECTlines. Keep both, each in its own brace scope:The trap is that both blocks open a
{and the diff shows only one closing}after them — merging naively drops one test's body into the other and neither runs.What I verified after resolving those
Linux (Nobara, GCC 16.2.1) on a
mainwithin 28 commits of current:cmake -S runtime+ full build: cleanroot_signature_test: PASSctest: 72/72 passed, 0 failedWindows (MSVC 14.44.35207,
-DLEONIDA_BUILD_WINDOWS_RUNTIME=ON) — because the two conflicted files are Windows-only and Linux never compiles them:ctest: 3 failures, and I confirmed all three are pre-existing by reverting the whole patch, rebuilding and re-running on pristinemain:gameinput_host—create hr=0xD000003A, no GameInput runtime on that boxxgameruntime_offline,xgameruntime_offline_hdr—XDisplayAcquireTimeoutDeferralneeds a display power request the test host can't grant; this patch provably does not touchxgameruntimeat allNothing in
mainsince your base changed the meaning of your 6 commits — the rebase was purely these two collisions, so your content survives intact (mesh_ok,root_window,user_data_dword,LEONIDA_GRAPHICS_ROOT_LAYOUT,tests/semantic/test_ms_root_window.pyall verified present).One thing from your thread worth carrying forward
madhyn's A/B (19:03) found that with the console layout the first draws read through the title's own tables and then the GPU faults on a read in the
0xe7…title-memory range — which isRT-TITLE-HOST-REGION(#1273), not this PR. So this PR looks necessary-but-not-sufficient for a visible frame; worth saying so in the PR description so a reviewer doesn't read "still black" as a regression from this change.Happy to do the rebase for real and push it to my fork if you'd rather not spend the time on the conflicts — just say so and tell me which
mainyou want it based on. Otherwise the two resolutions above should take a few minutes.AI-assisted (Hermes Agent) — the rebase, both platform builds and the pre-existing-failure control were run here.
@aslan2142 on GitHub · 2026-11-25 03:00 UTC · original
Merged, after merging
maininto it.mainalready had the graphics console layout through #939/#984, so what this adds is the mesh root window. Thanks.D3D-448-GRAPHICS, valid, before this PR.main: the graphics layout (pack_stage(Stage::Pixel),graphics_console,LEONIDA_GRAPHICS_STAGE_LAYOUT=0).LEONIDA_GRAPHICS_ROOT_LAYOUT=pcis dropped as a duplicate of=0.user_data_dword, the translator'sroot_windowinindex.json,mesh_ok, both refusals and their tests. Mesh shaders now read their root arguments from s16 through the graphics window, instead of 8 dwords early, andd3d12_mesh_testno longer pads its signature onto s0.Spill::block. A graphics signature over 24 dwords keepsmain's s0 fallback, under which both measured boots ran (AMD to the first-run screens, NVIDIA to the story load). It would also skipmain's direct heaps, which are placed only whenpack_stagesucceeds. A follow-up can make the case for it with a run.kNoSgprguard: onmain, a spilled compute parameter wrapped round to s0.make_game.py --stages shadersagain.main.root_signature_test77 pass;test_ms_root_window4 of 4.main0eeb1e663+b8563e949: it merges cleanly; the 14 docs and writer tests pass;check_no_game_data.pyis clean on the 15 changed files.AI-assisted (Claude Code, Claude Opus 5.5).