Merges main at1154976d4into the integration branch at273b3bdf9(merge baseece4ba5b3). 42 files conflicted; this commit is the resolution only. Build and test repairs follow in their own commits. Rule of resolution: where both sides added different things, both stay; where both made the same change in two forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two changed the same code for different purposes, both purposes are kept. Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h, d3d12_xs_desc_clean.h, registry.cpp): - d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and list slot 139 (#396). - Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider pc_resource_desc, S_OK for queue slots past the PC table. - Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base list proxy, its null-view slot 70 and its refusing slot 133. Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp): - Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra cases added; main's --env-slots-74 and #984's --env-slots-70. - Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy, the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases. D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h, frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp, d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp, vk_pipeline_check.cpp, vk_test_device.h): - Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's origin, so both pools run on disjoint sets of textures. - frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter. - main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4 stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980). - shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it. - Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it. Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp, runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp): - ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file. - gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries. - Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped. Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1, make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py, runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md, runtime/README.md): - Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake. - rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped. - shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags. - shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants. One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
10 KiB
The retail boot chain: what stops gta6rt --run, in order
Status: measured on one machine, 2026-11-23. A measurement for RT-5, not a claim; RT-5 stays with its owners
on the coordination issue. Each row is the first failure with every fix above it in place. Nothing here quotes
the executable: no addresses, offsets, IID values or bytes; only export names, public SDK types, vtable slot
numbers, call shapes and counts. boot.md has the runbook that produced the traces; #6715 maps the same
executable under --dry-run.
Setup: main 1cc6e3c12 with #6709, #4531, #6582, #4313, #4348 and #2490 merged locally, plus the local
stand-ins named below (not pull requests yet). Own 1.0.2.1 copy, Windows 11, RTX 4090 (driver 617.42),
LEONIDA_D3D12=vulkan, MSVC 2022 RelWithDebInfo build.
1. The chain
| # | Stop | What clears it |
|---|---|---|
| 1 | The first XMemVirtualAlloc calls: two 64 KiB reserve forms, then 2 MiB pages |
#6709, #4531 |
| 2 | The 2 MiB reserve+commit calls carry attribute words the shim refuses, and PAGE_GRAPHICS_* bits (0x800..0x40000) on top of PAGE_READWRITE |
Local: accept the attribute word, drop the graphics bits and keep the CPU protection. All seven startup allocations then succeed. #6843 measures the attribute words; no PR changes the check yet |
| 3 | xgameruntime.lib's thunk treats a missing XErrorReport as fatal |
#6582 |
| 4 | Access violation in the title's allocator: its /GA code reads its TLS from module index 0 |
#4313 in the measured tree: the runtime's own EXE gives up index 0 at process start. main has a different fix since b7a3fed28 (with 4710549af for threads that were already running): the loader rewrites the executable's index-0 reads so that they reach the image's own block (boot.md §3, step 3). Checked on main with a synthetic /GA executable beside a DLL with TLS of its own (loader_tls) and a /GA build of the stand-in game under gta6rt --run (run_tiny_game_ga_tls); the retail run was not repeated for this note, it needs game files |
| 4a | Wine only, not reached on Windows: GameInput.dll ordinal 1, the executable's GameInputCreate import (by ordinal, not by name), which the loader looks up as gameinput.dll!#1. When gta6rt doesn't serve that name, the import binds to the host's GameInput.dll. On Windows the installed one answers; under Wine it is Wine's builtin stub, and the title reads through a null pointer right after the call. Measured by hcristosm after stop 4 with stop 5's fix (old upstream PR 4348) merged, so its order against stop 5 is not measured. #127 reproduced it on Wine 11.21 staging: the title's own int3 0.65 s after start, before any D3D12 call |
#127 (the #1 alias in the shim table, runtime/shims/gameinput.cpp), but only in a gta6rt built with the GameInput shim, that is with SDL3: an installed SDL3 3.2 or newer that CMake finds, -DLEONIDA_SDL3_FETCH=ON (scripts/build_runtime.ps1 -FetchSdl3) or -DFETCHCONTENT_SOURCE_DIR_SDL3. A build without SDL3, one with -DLEONIDA_SDL3=OFF, and build_runtime.ps1's cl.exe fallback have no GameInputCreate at all (gameinput.md), so they still stop here under Wine. With the shim and the alias, the Wine run went on to stop 6 in hcristosm's measurement |
| 5 | Fatal assert when DStorageGetFactory returns null |
#4348 |
| 6 | XMemAllocatePhysicalPages unimplemented; the title asserts on FALSE |
Local stand-in, §2 |
| 7 | D3D12XboxCreateDevice succeeds; device slot 26 is called with its arguments swapped |
Local, §3.1 |
| 8 | Device slot 48 is forwarded to the PC slot 48 and fails | #6954 |
| 9 | Device slot 73 is forwarded to the PC slot 73; the title then reads through a null list | #2490's list proxy plus local routing, §3.3 |
| 10 | An XMemVirtualAlloc reserve of about 185 MiB with type 0x42000, attribute 7 and PAGE_NOACCESS is refused with ERROR_INVALID_PARAMETER. 0x40000 is MEM_RESERVE_PLACEHOLDER on the PC, which VirtualAlloc refuses and only VirtualAlloc2 accepts; stop 11 supports the same reading on the console |
Local: reserve it with VirtualAlloc2(MEM_RESERVE | MEM_RESERVE_PLACEHOLDER) |
| 11 | The title carves five sub-ranges out of that placeholder with MEM_RESERVE | MEM_REPLACE_PLACEHOLDER | MEM_PHYSICAL | MEM_LARGE_PAGES (0x20406000) at addresses inside it, then allocates a second batch of physical pages |
Local: a physical reserve inside a known placeholder stays a placeholder (the page maps split it); other MEM_REPLACE_PLACEHOLDER calls split the range and allocate it in place |
| 12 | Device slot 133 is called; the proxy table had 128 slots, so the call went through a null pointer | Local: a 192-slot table, and a slot 133 stand-in, §3.4 |
| 13 | Current stop: right after the first CreateDescriptorHeap, the title calls the heap's slot 9 (GetCPUDescriptorHandleForHeapStart on the PC), takes the handle from rax and asserts that it equals a value it already holds. Hypothesis: a console descriptor heap starts at an address the title chose or can predict, which the PC handle doesn't match |
Open: a question for the descriptor model (boot.md Q4) |
Row 4a is the one row measured under Wine (by hcristosm on Wine 9.0, also reproduced on Proton Experimental; by #127 on Wine 11.21 staging), not on the setup above. It is numbered 4a so that the Windows stops keep their numbers.
At stop 13 the D3D12 trace holds 1,185 calls: the device, 5 command queues, 5 fences, 7 command allocators,
581 command lists created and closed, a shader cache session, XboxIDXGIDevice::GetAdapter, one failed
ID3D12Device10::CreateReservedResource2, the first CreateSampler2, one committed resource (the slot 133
stand-in) and the first descriptor heap.
Without a debugger, the unhandled int3 of a fatal assert ends the process with C0000374 (heap corruption) or
C0000005 during teardown, not 80000003. An exit code of C0000374 from --run can be such an assert, not a
heap bug.
2. Physical pages (xmem.dll)
The shapes, from the call sites and the checks that follow them:
| Export | Shape |
|---|---|
XMemAllocatePhysicalPages |
BOOL (ULONG64 attributes, ULONG_PTR* page_count /*in/out, 64 KiB pages*/, ULONG_PTR* page_array); the title checks both TRUE and the count written back. Attributes seen: 0x280, 0x380 |
XMemVirtualAlloc |
the range for those pages is reserved with MEM_RESERVE | MEM_PHYSICAL | MEM_LARGE_PAGES (0x20402000) and no MEM_COMMIT |
XMemMapPhysicalPages |
(va, page_count, page_array); a null page_array unmaps; non-null return on success |
XMemMapPhysicalPagesScatter |
(va_array, page_count, page_array), the same with one VA per page |
XMemFreePhysicalPages |
(page_count, page_array) |
The local stand-in that gets past stop 6 is CPU-only: one pagefile section per 64 KiB page
(CreateFileMappingW(INVALID_HANDLE_VALUE, …, SEC_COMMIT)), page numbers handed out as indexes into that table,
the physical reserve made with VirtualAlloc2(MEM_RESERVE | MEM_RESERVE_PLACEHOLDER), each map a
VirtualFree(MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER) split followed by MapViewOfFile3(MEM_REPLACE_PLACEHOLDER),
and each unmap UnmapViewOfFile2(MEM_PRESERVE_PLACEHOLDER). #5381 has the CPU half of physical pages with dirty
tracking and #5378 a Vulkan sparse-binding mapper; neither is wired to these exports.
3. Device calls whose Xbox shape differs from the PC
3.1 Struct-returning methods take the return buffer first
Device slot 26 (GetCustomHeapProperties, which returns a D3D12_HEAP_PROPERTIES) is called as
(return buffer, this, node_mask, heap_type): the first register holds the return buffer, the second the device
proxy. The PC MSVC method expects (this, return buffer, …). A proxy thunk can tell the two apart: in the swapped
call the this register does not point at the proxy, and the second argument does. Calling the real method with
the two exchanged and returning the buffer pointer gets past it. Other struct-returning slots probably follow the
same rule; only slot 26 was reached.
3.2 Device slot 48 creates a command queue
Xbox device slot 48 is (desc, riid, out) with riid = IID_ID3D12CommandQueue. desc starts with a PC
D3D12_COMMAND_QUEUE_DESC (Type, Priority, Flags, NodeMask) followed by Xbox words. On the PC, slot 48 is
OpenExistingHeapFromAddress, so forwarding by number fails. Creating the queue from the 16-byte PC prefix, with
Flags limited to D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT, through the existing queue proxy works: four
queues come from this slot, the first of them a compute queue. The first queue comes from slot 8, as on the PC.
3.3 Device slot 73 creates a command list
Xbox device slot 73 is (desc, allocator, pso, riid, out). desc is 16 bytes and its first word reads as the
D3D12_COMMAND_LIST_TYPE. riid is a console command-list IID that is not in the PC SDK (#3520 records that the
package doesn't export it). A retail run logged it as {c3827890-4024-474c-98cf-645b51dc4874} (#445). Creating an
ID3D12GraphicsCommandList of that type and handing out #2490's console list
proxy gets all 581 lists created and closed.
3.4 Device slot 133 places a resource at a virtual address
Xbox device slot 133 is (va, const D3D12_RESOURCE_DESC*, state, clear, riid, out) with riid = IID_ID3D12Resource
and state = 0xFFFFFFFF, which isn't a valid PC state. At the first call, va is the start of a physical-page
range the title had just reserved, and desc is a buffer of that range's size with Xbox bits in Flags above
the PC flags. The shape matches the console CreatePlacedResourceX. A buffer on those pages is imported with
VK_EXT_external_memory_host where the driver allows it, so the title's writes are the GPU's reads; a driver that
refuses falls back to a committed buffer. A texture gets a committed texture whose GetGPUVirtualAddress is the
title's address (the console behavior: a title clears a texture through that pointer), but its pixels do not alias
the title's pages yet. Both paths limit Flags to the PC bits; the buffer path also makes the Xbox layout word
ROW_MAJOR.
The proxy's slot table must also be longer than the title's highest slot. A shorter table leaves a null pointer,
not an E_NOTIMPL.
4. What this does not show
These are one run's first failures, not a list of what is missing. Every stand-in above is local and untested beyond "the title goes on to the next call". Nothing has reached a draw or a present yet.