Skip to content

docs/retail_boot_chain.md: stops 13-17 (descriptor heap at an address, device slots 70, 127, 25) - #6982

Open
Pipodi wants to merge 1 commit into
ItsNotRexed:mainfrom
Pipodi:docs-boot-chain-stops-14-17
Open

Pipodi wants to merge 1 commit into
ItsNotRexed:mainfrom
Pipodi:docs-boot-chain-stops-14-17

Conversation

@Pipodi

@Pipodi Pipodi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: RT-5 measurement (data for its owners, not a claim; follow-up to #6915)

Depends on: none (docs only). #6915 is merged; this extends its page.

What and why

#6915 stopped at stop 13: the title asserting on the first descriptor heap's CPU start. This adds what came after, on the same machine and build:

  • Stop 13, cleared locally. The Xbox D3D12_DESCRIPTOR_HEAP_DESC carries a CPU address and size after the 16 PC bytes. The title asserts that the heap starts there. Giving the Vulkan heap that memory as its CPU storage clears it (§3.5).
  • Stop 14: device slot 70 makes an SRV from raw descriptions and a GPU address, with no resource. It is currently forwarded to PC CreatePlacedResource1 (§3.6).
  • Stop 15: device slot 127 has CreateCommittedResource3's argument list, but it sits past the PC vtable (§3.7).
  • Stop 16: device slot 25 (GetResourceAllocationInfo, called as (ret, this, …)) passes Xbox descriptors unchanged.
  • Stop 17, current: a fatal budget assert after the first full-screen render targets. The PC allocation sizes come out smaller than the console's, so too much of a fixed budget is left over.

The trace now holds 1,641 D3D12 calls, up from 1,185.

Tested

AI-assisted: yes (Claude Code)

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. Only public SDK types, struct offsets of SDK-shaped descriptors, slot numbers and counts; no executable addresses, offsets, IID values or bytes.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

…, device slots 70, 127 and 25)

Follow-up to ItsNotRexed#6915. Stop 13 is cleared locally with the heap at the title's
address; slot 70 (an SRV from raw descriptions), slot 127
(CreateCommittedResource3's argument list) and slot 25 (allocation info with
Xbox descriptors) come next. The current stop is a render-target budget
assert that the PC allocation sizes trip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonbronk

Copy link
Copy Markdown
Contributor

Thanks for the measurements. I have my own 1.0.2.1 copy and can reproduce on Windows 11. Of the PRs that clear stops 1–12, only #6582, #6964 and #6953 merge cleanly on current main; the xmem ones (#4531, #6709, #6919, #6995) and the device ones (#2490, #6935, #6954, #6973) conflict in xmem.cpp and d3d12_xs_device.cpp. Could you push your local integration branch (code only, no game data) so others with the executable can start from stop 17 instead of rebuilding stops 6–16? I'd like to help measure the console's render-target allocation sizes for stop 17.

AI-assisted (Claude Code).

@Pipodi

Pipodi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@simonbronk here it is: Pipodi:boot-integration (code only, no PR). Commits marked LOCAL and code marked not for main are stand-ins, not proposals. tedin7 and Khuraie (#7021) are turning the measured shapes into real PRs on #6910.

Base: main 1cc6e3c12 with #4531, #6709, #6582, #4313, #4348 and #2490 merged in. It doesn't merge cleanly with current main yet (xmem.cpp, d3d12_xs_device.cpp, CMakeLists.txt), so build it as it is.

To run it past stop 17:

  1. Build gta6rt (RelWithDebInfo) and run with LEONIDA_D3D12=vulkan.
  2. LEONIDA_SKIP_ASSERTS=20: a new opt-in vectored handler in main.cpp. It logs and steps over up to N int3 in guest code (not in host modules). Stop 17's budget check is one of these. A second assert comes later.
  3. LEONIDA_SHADERS=<folder>: one folder holding both your make_game.py SPIR-V and the 52 shaders embedded in XboxBvhBuilder.dll, with the two index.json files merged (the keys don't clash). The embedded set is made by docs/embedded_shaders.md's commands (pe_shader_containers.py --extract → fssm_unpack.py → shader_disasm.py --mcpu gfx1013 → rdna2spirv.py). Use current main's translator: with rdna2spirv: 8/16-bit MUBUF loads and stores (buffer_load_ubyte/ushort/d16, buffer_store_byte/short) #1864, all 52 translate and pass spirv-val; the branch's older translator manages 51. Without them, the title stops at the first BVH-builder compute pipeline.

Where it stops now (1,655 D3D12 calls):

  1. All BVH-builder root signatures and compute pipelines are created.
  2. Device slots 39, 27 and 41 are forwarded by number and return.
  3. A second guest assert is skipped.
  4. Device slot 61, forwarded to the PC slot 61, ends in an access violation inside the runtime.

The next thing I'm measuring is slot 61's Xbox shape. On the render-target sizes for stop 17: on the PC the full-screen target asks GetResourceAllocationInfo for one 33,423,360-byte allocation with 64 KiB alignment. A console-side size for the same desc would settle it.

AI-assisted (Claude Code).

@simonbronk

Copy link
Copy Markdown
Contributor

Reproduced on boot-integration (RTX 5070, Windows 11, Vulkan): with LEONIDA_SKIP_ASSERTS=20 and the 52 embedded shaders (current main translator, 52/52 spirv-val) the run reaches the same frontier: slots 39/27/41 return, then slot 61 → access violation in the runtime. On a 32-wide NVIDIA GPU the embedded set needs --wave64-emulate, otherwise the runtime warns on two wave64 compute shaders. I'm looking at slot 61's shape locally too and will post what I find here, so we don't duplicate; happy to rerun any build you push.

AI-assisted (Claude Code).

@Pipodi

Pipodi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@simonbronk thanks for reproducing it. Two updates so we don't duplicate work:

Slot 61 is settled by #7115 (mrp1no): CreateSamplerX(desc, dest) → PC CreateSampler. I tested it on this stack (report) and dropped my stand-in. With it plus #6891 (xg_xs: its texture computer is called at once afterwards and needs a non-null object), the run reaches 1,661 D3D12 calls.

The new frontier is slot 67 from the executable itself, not from the FidelityFX DLL. docs/fspx.md only knows the DLL's caller.

  • 28 DeserializeComputePipelineStateX calls, all from one call site in the exe. Kind 0 is 28 B, kind 1 is 20 B, kind 6 is 384 to 1,024 B, kind 7 is 280 to 472 B.
  • The 28 kind-6 programs are 28 different byte strings. They have no common 0x100 prologue (unlike the DLL's).
  • None of them is among the upscaler DLL's 29 programs (that DLL isn't even loaded at this point). None is in XboxBvhBuilder.dll or in the exe file as plain bytes. None is in any of the 25,734 carved FSSM blobs (32-byte windows, no hits).
  • So every call fails with no translated compute shader and returns E_INVALIDARG. After that, two more guest asserts and a guest access violation follow.

The open question is where the title gets these programs: a package archive we don't carve yet, or something it decompresses or builds at run time. If you look into it, the caller is the thing to trace. I'm on the same question. Your --wave64-emulate note is right for the 4090 too.

The branch is updated to this state. Counts only, no game files. AI-assisted (Claude Code).

@simonbronk

Copy link
Copy Markdown
Contributor

Two results from my run of boot-integration plus #7115, #6891, #7163 (in its shape), #3777 and #6935 (slot 80). RTX 5070, Windows 11, Vulkan:

  • Fence slot 12, past the PC chain: (value, &{0, callback, 0, 0}, flag). The title uses the return value as a pointer to the fence's 64-bit completed value. It compares *p with ~0 (device removed) and checks *p - value. With the proxy's E_NOTIMPL, the title dereferences 0x80004001 and crashes. A local stand-in returns the address of a per-fence mirror refreshed from GetCompletedValue(), and the run then moves on to command-list recording (list slots 20–24, 34, 44, 47, 50, 70, 75, 126, 142 get first calls). The real semantics probably need that memory to stay live (a GPU-written or updater-thread value), not refreshed per call.
  • runtime: DirectStorage zlib requests (file and memory sources) #7180 (zlib DirectStorage) on top: the zlib requests are inflated and the buffers change (42 distinct kind-6 hashes instead of 39; 31 are still the same). Every slot 67 call still fails with no translated compute shader, so these programs aren't in any translated set yet. The run then stops on a null object read in title code, which I haven't traced yet.

Fence slot 12 isn't claimed in #7049 as far as I can see. I'm leaving it to whoever owns the queue/fence proxy and only posting the shape here.

AI-assisted (Claude Code).

@simonbronk

Copy link
Copy Markdown
Contributor

Follow-up with #7180 merged on the same stack (RTX 5070, Windows 11, Vulkan):

  • The slot 67 programs are real after runtime: DirectStorage zlib requests (file and memory sources) #7180. I kept the refused payloads locally (kind 0/1/6/7 as the proxy builds them, in my own work folder only): 42 distinct calls, every kind-6 program non-zero with the FSPX prologue (words 0, 3 and 6 = 0xD580…).
  • They translate with the existing tools as they are. tools/fspx_unpack.py --disasm unpacks all 42. tools/rdna2spirv.py --no-asm --wave64-emulate then translates 38/42, 38 spirv-val-valid; the 4 others are refused by the CS thread-group-size SGPR rule. With that output as <shaders>/fspx/, every slot 67 call succeeds (0 no translated compute shader). So the missing piece is only where the build finds these payloads in the package (the zlib DirectStorage source), not translation.
  • The next stop is slot 57. On this branch it is forwarded to PC slot 57, which is ID3D12Device5::CreateLifetimeTracker (not supported). The title calls it once, gets no pipeline, and a few calls later reads a null field of its bound graphics-pipeline object (read at 0x68). That's @KkelebekK's claim 1 in Coordinating who works on what (41) (moved to #7231) #7049 (native graphics pipelines). I'm not touching it, and I'm happy to run their branch here as soon as it's pushed.

AI-assisted (Claude Code).

@memorypressure

Copy link
Copy Markdown

Verified at 01f2221, clean merge with current main 8575d36. Docs-only: stops 13-17 and sections 3.5-3.7 added to the boot-chain page with the page's own measurement-citation convention (build sha, copy 1.0.2.1, Windows 11, RTX 4090, driver 617.42, LEONIDA_D3D12=vulkan), the "a measurement for RT-5, not a claim" status line kept, and no exe bytes or addresses quoted. Stand-ins are honestly labeled untested beyond title. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@simonbronk

Copy link
Copy Markdown
Contributor

More from the same stack (RTX 5070, Windows 11, Vulkan), with LEONIDA_SKIP_ASSERTS lowered so each title assert stops the run:

  • The title assert during resource setup is slot 25 returning UINT64_MAX. The title asserts that GetResourceAllocationInfo's size is under 4 GiB. Two descriptions the console accepts and the PC refuses: B5G5R5A1_UNORM with RT+UAV, and R32G8X24_TYPELESS with depth-stencil+UAV. Locally, sizing them without the refused usage (UAV first, then RT) clears the assert. Resource creation will need its own answer for these formats.
  • Device slot 74 = (VA of the 6 GB physical allocation, 64 KiB page count, &handle). The generic route forwards it to PC ShaderCacheControl, which fails, and the title asserts. Accepting it with S_OK and a non-null handle clears that assert. The title keeps the handle in a global; I haven't seen it read back yet.
  • Device slot 57 with @KkelebekK's layout: I tried a local stand-in (digest table from my own <work>/shaders/dxbc, state B decoded as they describe). The first call resolves both containers (VS_Blit/PS_Blit-style pair, 1 RT, 3 inputs) and reaches vkCreateGraphicsPipelines. I'll leave the real implementation to their claim.
  • Slot 108's 4 MiB alignment is correct: those descriptions are 4-sample MSAA.
  • The run still ends with the same read at 0x68 on the render thread. The title's default programs are all set by then, so it isn't them.

AI-assisted (Claude Code).

@gkissel

gkissel commented Nov 23, 2026

Copy link
Copy Markdown

The same chain reproduced under Wine 11.21 on Linux (clang-cl + xwin cross build, -DLEONIDA_SDL3_FETCH=ON, LEONIDA_D3D12=vulkan, GTX 1650 Mobile 4 GB, NVIDIA 620.70), own copy of 1.0.2.1. It uses only open PRs plus two Wine-specific fixes, adding one PR at a time on top of main 08c1aa634, with 2 runs per step. Outcomes only, for anyone testing on Linux:

step stop on Wine cleared by D3D12 calls
0 main: read of 0x0 in host_module_name (the /GA slot-0 TLS) #4313 0
1 third XMemVirtualAlloc (2 MiB pool, attribute 0x183) #6919 0
2 XErrorReport not served #6582 0
3 GameInput.dll ordinal 1 binds to Wine's builtin stub, which fails (Wine-only) #7216 + an SDL3 build 0 → device created
4 device slot 26 (struct return) #6964 5
5 compute queues refused (console queue flags) #7037 13
6 slot 73, console list IID #2490 + #7076 1,181
7 XMemMapPhysicalPages into the descriptor pool returns NULL: Wine refuses PAGE_WRITECOMBINE views (Wine-only) fix offered on #6919 (comment there) 1,181
8 slot 133 through a null table entry #6953 + #7218 (VK_EXT_external_memory_host works under winevulkan) 1,183
9 stop 13, descriptor heap start #7021 1,198
10 stop 14, slot 70 #7066 1,632
11 stop 16, slot 25 (GetResourceAllocationInfo) faults in proxy_slot<25> in progress on my side 1,632

#4348 was merged at step 2 and changed nothing observable there. Conflicts between these PRs were all mechanical: slot lists, mock-test hunks, and #7066's route helper needing #7037's proxy_create_command_queue_x. I resolved them locally only; that local branch isn't pushed.

Two notes for Linux users:

AI-assisted (Claude Code). No game files, bytes or code addresses here.

@TreXito

TreXito commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@gkissel on step 11 (proxy_slot<25> faults): this is the same argument order as slot 26, and #7110 already handles it.

Static check of the retail 1.0.2.1 executable: every device slot-25 call site whose setup is in view (3 sites) uses the C form. RCX holds a return buffer on the stack. RDX holds the device, and the vtable is loaded from RDX. R8 is 1 (the visible mask), R9 is 1 (one description), and the description pointer is the fifth argument on the stack. After the call, the title reads the 16-byte result out of that buffer. One caller compares the alignment with 4 KiB. The other tests that the size's high dword is 0, which is the "under 4 GiB" assert simonbronk reported. #6964 deliberately changes only slot 26, so on that stack the proxy treats the buffer as the device. #7110 (tedin7) takes the console form for slots 25 and 26 when RDX holds the proxy.

Slot numbers, argument shapes and counts only. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants