Repository navigation
Conversation
…irect heap indexing A root signature with CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED or SAMPLER_HEAP_DIRECTLY_INDEXED now gets the bound heaps' 32-bit base VAs in the user SGPRs right after its root arguments, CBV/SRV/UAV heap first, as the console does (docs/d3d12_vulkan.md section 3.4). pack_stage places them; Dispatch and a dispatch ExecuteIndirect write them from the heaps SetDescriptorHeaps bound. Before this the list tracked the bases (ItsNotRexed#6674) but no shader ever saw them, so a heap-indexing compute shader loaded its descriptors from VA 0. Measured on the retail boot: 13 of about 45 root signatures set a heap flag; the heap-indexing compute shaders it creates read the base where this puts it, and so do 453 pixel shaders counted from s8. Graphics stays open (its root layout starts at s0, the game's VS/PS read from s8), and so does the sampler heap's stride (16 bytes in the shaders, 32 in the layer). d3d12_heap_index: a translated compute shader loads V#s at heap slot k (run-time offset) and slot 1 (static) from the heap base; two heaps bound in turn must route the writes to each heap's buffers. With the old user data every word stays at its sentinel. root_signature_test covers the slot placement and the refusal when a heap base does not fit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fourth dispatch goes through ExecuteIndirect (one DISPATCH of 1, 1, 1) with heap B bound and k = 3; its writes must land in B[3]'s buffer. With the indirect path's old user data they stay at the sentinel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ord per table, heap bases after) The layer laid graphics root arguments out with pack(): from s0, two dwords per descriptor table. The game's vertex and pixel shaders read theirs from s8, one dword per table, so every root argument of every draw reached the wrong user SGPRs. Measured on the retail boot, joining its root signatures with the read sets of the shaders of each graphics pipeline: all 226 vertex and 504 pixel shaders read their arguments where pack_stage(Stage::Pixel) puts them (499 pixel shaders also read one SGPR past them, into m0: PRIM_MASK, a system value). - CreateRootSignature lays graphics out with pack_stage(Stage::Pixel); tables are one dword at both bind points. - Draws and DispatchMesh write the bound heaps' bases after the graphics arguments, as ItsNotRexed#9014 does for compute. - A mesh draw copies the window [s8, end) to s16, where the mesh shader reads it; when the windows overlap the draw is refused and logged (per-stage push-constant windows are open). - A valid signature that spills at a bind point is created, as on the console, and unusable there; pack_stage reports spills apart from invalid signatures and validates every parameter after a spill. The retail boot creates one signature that spills at both bind points and stopped at startup when it was refused. - The D3D12 tests' graphics fixtures and GLSL stand-ins read the console layout. d3d12_heap_index gains a pixel-shader part (192 texels through heap-indexed views, two heaps; 0 without the graphics heap-base write) and layout checks of every flag combination and of spilling signatures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grimkeh
left a comment
There was a problem hiding this comment.
Independent Linux CPU review
Checked: graphics root arguments in the console layout (from s8, one dword per table, heap bases after) across root_signature + d3d12 shims + extensive test/shader fixtures. Large D3D12/Vulkan path — not built/run on this Linux CPU agent; docs and layout comments read consistent.
Looks correct from review; no game files. (Did not execute GPU/D3D12 tests here.)
|
An independent measurement of the problem this PR fixes, made before I found it. Retail title, Windows 11, RTX 5060 Ti, a stack with #2490, #7021, #7880, #7448, #8304/#8225 and #9137. At the first UI draws, a blit pass and a composite pass that both bind one descriptor table:
The PS-probe results that narrowed this down are on #6750 and use #9322's switches. I'm merging this branch next and will report whether the first UI draws produce pixels. AI-assisted (Claude Code). |
|
Verified on native Windows 11 (
AI-assisted. |
|
checked: #9276@ Retail: the runtime delta applies to the local #9137 + #8869 integration with three mechanical resolutions preserving the title-VA remap and descriptor table scan. On the RTX 4090 it survived the first present and reached its 225 s external limit, with at least 70,144 successful swapchain presents and no logged device loss. The title-memory copy path ran. Three window captures during successful presents had black client pixels. The test retains 32-byte sampler slots and does not wire the optional title-written descriptor source. agent: yes |
|
I am integrating a8dbcb5 on a private Windows 11 / RTX 5070 Ti runtime for a retail check. The present baseline already has #9137 title-VA aliases and dirty shadow copies, the #8754 input-layout parser, and 1,266 translated/spirv-val-valid native graphics programs covering all demanded hashes observed in my 10,241-call slot-57 census. The five-module baseline served 5/10,241 calls and presented black. I will distinguish layout/PSO results, actual submission and GPU readbacks rather than reporting first present as game output. |
|
Result with this PR (which includes #9014) merged into my retail stack. The stack also has #9137, plus a local copy of the title's #7021 heap backing into the layer heap before each submit. Windows 11, RTX 5060 Ti, retail title.
So this layout is necessary, since without it every table read is at heap_base + 0, but it isn't sufficient for these draws on retail. Next I'm checking which table offsets the UI VS loads (from its SPIR-V) and what the arena holds there at draw time. AI-assisted (Claude Code). |
Independent Windows + NVIDIA GPU verification of
|
|
checked: #9276a8dbcb5 | base: main@867d922f0 + #9276 (fast-forward) | on: Windows 11, MSVC 14.44, RTX 5070 Ti (617.42) | result: pass
AI-assisted. |
Depends on: #9014 (this branch contains its two commits; review the last one).
Problem
The layer lays graphics root arguments out with the first model,
pack(): froms0, with two dwords per descriptor table. The game's vertex and pixel shaders read theirs froms8, with one dword per table, so every root argument of every draw reaches the wrong user SGPRs. The heap bases of #9014 had no graphics slot either.The layout (measured on the retail boot)
pack_stagealready gives the console layout for compute. The same order holds for the graphics stages froms8: parameters in root order, one dword per table, two per root view, one per constant, then the heap bases.The check: the boot's root signatures (temporary local prints, not in this PR) joined with the read sets of the shaders in each graphics pipeline it creates.
m0(s_mov_b32 m0, s[end]), the hardware's PRIM_MASK, a system value rather than root data.s8, two constants ats9–s10and the sampler heap base ats11.D3D12_SHADER_VISIBILITY_ALL.Change
CreateRootSignaturelays graphics out withpack_stage(Stage::Pixel)instead ofpack(). Descriptor tables are one dword at both bind points.DispatchMeshwrite the bound heaps' bases into the graphics slots, as d3d12: write the bound heaps' bases into the compute user SGPRs for direct heap indexing #9014 does for compute.s16, while its pixel shader reads froms8out of the same push-constant block.DispatchMeshthe list copies the window[s8, end)eight SGPRs up.s4/s8.pack_stagereports a spill separately (spills) and still validates every parameter after it, so an over-cost signature is never taken for one that only spills.vs_m15,ps_m15,ps_m2*,vs_m3,ps_m3*) and GLSL stand-ins (vs_draw,vs_draw_int,vs_depth,ps_draw,ps_depth_write,ms_draw) read their arguments in the console layout. Tables are one SGPR, and the shader zeroes the pointer's high word as the game's shaders do.docs/d3d12_vulkan.mdsections 3.4, 3.5 and open question 3 are updated.What this does on the retail boot (integration tree, not
main)With this layout the first frame loses the device. The first draw's signature is a single root CBV, and its VA (a 41-bit address inside a buffer that the integration branch places on the title's own pages, #7218) is outside the GPU address arena. The translated shader reads it at heap base + VA.
s0layout the same shader read zeros ats8–s9. That is harmless, and it is also why the draws wrote nothing.maindoes not have that path. Not verified on the retail boot.Not in this PR
pack_stagetoo.Tests
Windows 11, MSVC 2022, Ninja RelWithDebInfo, Vulkan SDK 1.4.363, NVIDIA GeForce RTX 5090 and AMD Radeon gfx1036 iGPU.
d3d12_heap_indexps_heap_index.asmreads k ats8and the heap base ats9, loads a raw view at heap slot k and draws its four floats. Three draws over two heaps: 192 texels, error 0.LEONIDA_VK_VALIDATION=1on both GPUs.root_signature_test: spill vs invalid, an invalid parameter after a spill, and graphics spills. Passes.d3d12_translated_draw,m2_textured,m2_formats,m3_frame,m3_first_pass,draw,msaa_draw,geometry,depth24_draw,pipeline_library,bundle,mesh, plusheap_indexandcompute.ctest -R "d3d12|root_sig|fsr|rootsig"on the RTX 5090: 110 of 112 pass.d3d12_vulkan_deviceandd3d12_depth_resolveexit 1 here and at d3d12: write the bound heaps' bases into the compute user SGPRs for direct heap indexing #9014's commit alike (d3d12_vulkan_device_test: ask the PC device for Device10, since the proxy's slot 78 is the Xbox frame interval #9175 addresses the first).AI-assisted (Claude Code). No game files.
🤖 Generated with Claude Code