The retail title asserts when its first full-screen render targets leave more than 2 MiB of a fixed budget unused (docs/retail_boot_chain.md, #6982). The PC size is about width x height x element bytes; the console takes whole RDNA2 SW_64KB tiles. Slot 25 adds the difference per render target description and never lowers a size. Depends on #6973.
(cherry picked from commit 8897855399)
- PipelineState is not compute-only: create_graphics builds graphics PSOs too.
- The R8/R16 SNORM and SINT input-layout formats are mapped (352b9af1), so the format-support note drops its "no mapping yet".
- Buffer UAVs exist (write_buffer_uav writes a typed V#); what the layer does not create is a VkBufferView.
- Timestamps are not read from "the one VkQueue every D3D12 queue submits to": the period is enabled from the graphics family's timestampValidBits.
Comments only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mock device answers GetResourceAllocationInfo, and the new case calls slot 25 with the return buffer in RCX
and the device in RDX, then in the PC form: both reach the PC method with the mask, count and descriptions, and
only the struct is written.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The retail executable calls GetCustomHeapProperties (device slot 26) with the
C convention: the hidden return buffer in RCX and the device in RDX. The
proxy's generic forwarder assumed the PC C++ form (this in RCX, buffer in
RDX), took the buffer for the device and crashed on its vtable right after
D3D12XboxCreateDevice.
Slots 25 (GetResourceAllocationInfo, same rule, inferred) and 26 (measured)
now get thunks that accept either form: whichever of the first two arguments
is the device proxy is `this`. The runtime's own code still calls the proxy
through d3d12.h in the PC form. device_proxy_test calls both slots in both
forms against WARP.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5dbc30bed7)
Adapted to main by Mumogg: slot 26 keeps the thunk it already has (86b8e04e4), so of this commit's two thunks
only slot 25's is installed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0cde63d618)
Adapted to main by Mumogg: main already routes slot 48 through its Xbox slot table (LEONIDA_XS_QUEUE_X_SLOT),
so the route now calls proxy_create_command_queue_xbox instead of a fixed slot 48 branch, and xs_proxy_mock's
check_xbox_slots and the environment case pass the console's 32-byte description.
The retail executable calls GetCustomHeapProperties with the return buffer in RCX and the device in RDX. The forwarder took RCX for the proxy and faulted.
AI-assisted.
(cherry picked from commit 86b8e04e4c)
- The "[rt] localdbg:" lines and the experiment switches are gone: LEONIDA_RECT_GREEN, LEONIDA_RECT_VS,
LEONIDA_RECT_NOGS, LEONIDA_RECT_NOCULL, LEONIDA_RECT_FORCE, LEONIDA_VTX_TEST and LEONIDA_DEBUG_CLEAR, with the
hard-coded test shader words. vulkan_replay.h returns unresolved_resource directly again.
- The descriptor write-through and the table mirror for title-backed heaps only copy between committed memory
they may read and write. A handle that is only a number (xs_proxy_mock's heaps) is left alone; the test
crashed there before.
- A slot 70 view over memory no buffer holds becomes a raw buffer view only when the title-memory registry
(title_va_alias.h) holds the whole range, instead of any address below 4 GiB. xs_proxy_mock's null-view case
passes again.
Still switches: LEONIDA_GRAPHICS_STAGE_LAYOUT, LEONIDA_DESC_MIRROR, LEONIDA_SLOT70_TITLE, LEONIDA_RECT_FOURTH.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
PAGE_GUARD is an access alarm, not a cache modifier (review on #7492). The comment
also says what the write-combine bit does on Windows, where the view is created
write-combined and #7218's import of those pages refuses it.
(cherry picked from commit 954fcb1061)
Three of the retail executable's five physical-page windows carry 0x400
(PAGE_WRITECOMBINE on the PC) next to PAGE_READWRITE. host_protect drops only the
PAGE_GRAPHICS_* range, so map_page passed PAGE_READWRITE | PAGE_WRITECOMBINE to
MapViewOfFile3, which refuses it with ERROR_INVALID_PARAMETER: the first
XMemMapPhysicalPages into such a window failed and the title's descriptor-heap
setup returned false.
view_protect now drops PAGE_WRITECOMBINE, PAGE_NOCACHE and PAGE_GUARD.
xmem_test maps a page into a window reserved with that protection.
AI-assisted.
(cherry picked from commit 7e8e3c1db1)
make_game.py and tests/test_library_shaders_stage.py are main's (parallel library translation, the shard plan,
verify_fspx_key_clash), with the exe_shaders call kept. shader_library.h still loads the exe folder after
library; shader_library_test keeps one copy of the library case.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
d3d12_rect_list passes again. The other rule stays behind the switch as an open question: it is the one that
covers the target for the retail title's full-screen rectangle draws.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
2dbcb882c (#6935) routes the Xbox-ABI device proxy's slot 78 to the console's SetFrameIntervalX. On the PC
ABI that slot is ID3D12Device10::CreateReservedResource2, which this test called through the proxy, so the
call answered S_OK with a null resource and GetResourceTiling of it gave 0: "line 6576: tiles == 1"
("d3d12_xs: device slot 78 routed to SetFrameIntervalX" in the log).
The Device10 call now goes through the inner Vulkan device, and the test checks that both resources were
created, so a success without an object fails at the call instead of at the tile count.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
resolve_compat() calls LoadLibraryExW on a file from LEONIDA_COMPAT_DIR. For
a file Windows cannot map (truncated, wrong machine, not a PE image) the
system raises a modal "Bad Image" hard-error box, and LoadLibraryExW does
not return until someone clicks OK. The loader reports that failure itself
one line later, so the box only stalls it: gta6rt hangs on a headless
machine, and loader_test, which writes such a file on purpose, waits for a
click in every unattended ctest run.
The load now runs with SEM_FAILCRITICALERRORS set on the calling thread, and
the thread's previous error mode is restored afterwards. The Windows error
code is read before the mode is put back.
loader_test checks that the mode comes back unchanged, that the message
still carries the error code, and that the refusal does not wait on a box.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- xmem.cpp: rt::xmem::commit_physical_range and commit_physical_pages exist for the run-mapped xmem too (pages
are committed when allocated, so they only check the range), and main.cpp registers the slot 133 hook as main
does.
- vk_test_device.h: VK_EXT_external_memory_host and host_pointer_alignment are back next to the A8 render
target probe; d3d12_existing_heap_test and d3d12_xmem_placed_test use them.
- xs_proxy_mock_test.cpp: the stack's version, which tests the proxy that is in the tree (the automatic merge
left two list mocks in one switch).
- d3d12_xs_device.cpp: no include of vulkan_replay.h, which the proxy tests without Vulkan headers could not
compile, and the diagnostic that needed it is gone.
Every target builds with clang-cl 22.1.8 + xwin.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The stack is ladder-frame (ASTROWwwW's integration of the retail boot pull requests) with the old pull requests
7604, 7286, 7584, 6446, 8591, 7384, 7535, 7448, 9137 and 9419 and local fixes on top. main carries many of those
commits as ancestors without their content, so the merge was made against main's tree, not its history: nothing
main dropped is dropped again here.
Resolved by hand:
- d3d12_xs_device.cpp and frame_pacer.h: the stack's Xbox-ABI layer, plus main's uncapped pacer and its two new
registration hooks (set_placed_at_va_pages_hook is called before slot 133's handler; the console descriptor
heap handler is stored but slot 14 still uses the title-backed heaps of old PR 7021).
- xmem.cpp, xmem_test.cpp: the stack's run-mapped physical pages. main's commit-on-touch xmem with the two
view-protection fixes it lost (7e8e3c1db, 954fcb106) boots to 50,468 pipelines and then fails a submit with an
unknown resource, so it is not used here yet.
- acphal.cpp, acphal_test.cpp, vulkan_replay.h (acceleration structure copy), README: main's.
- CMakeLists.txt, build_runtime.ps1, d3d12_com.cpp, d3d12_vulkan_device.cpp, shader_library.h, docs: both sides.
Measured (Linux, Wine 11.21 staging, RTX 5070 Ti, driver 615.78.08, clang-cl 22.1.8 + xwin, own 1.0.2.1 copy,
network off, LEONIDA_GRAPHICS_STAGE_LAYOUT=1, 300 s): 50,470 pipeline states created, 197,998 ExecuteCommandLists
with none failed, 148,467 DrawInstanced, 99,008 PresentX.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The retail executable imports GameInputCreate from GameInput.dll by ordinal 1. The loader looks ordinal imports up
as "#1", which the shim table did not have, so the import bound to the host's GameInput.dll. On Windows the
installed GameInput answers; under Wine it is the builtin stub, the call fails and the title stops on its result.
The alias maps #1 to the same GameInputCreate, and gameinput_test checks it.
(cherry picked from commit 5e45c7da94)
The merge that brought the mirrored pull requests into main (6dece9231) left the DirectStorage shim out, noting
that it "needs the typed-error zlib inflate". The shim's commits (f87d05fdd, ac1843da2, 00551ba00, by
mariuslozo-boop and Kelebek) are ancestors of main, but its files are not in the tree, so the retail
executable's XCRDAPI.dll!DStorageGetFactory import is unimplemented (issue #47, stop 5 of
docs/retail_boot_chain.md).
- shims/dstorage.cpp, shims/dstorage_xs_abi.h, test/dstorage_test.cpp and docs/directstorage.md are back as
those commits left them.
- leonida::zlib_inflate reports why it failed through an optional ZlibError* (header, data, checksum, limit),
which the shim turns into its E_DSTORAGE_ZLIB_* codes. This is the same interface the shim was written
against, added to main's current table-driven inflater; callers that pass no pointer behave as before.
- registry.cpp classes xcrdapi.dll!DStorageGetFactory as an HRESULT import, the retail spelling #47 found
missing.
- CMake and scripts/build_runtime.ps1 build the shim into gta6rt, and CMake builds and registers dstorage_test.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Since 4da716493 the layer refuses a whole ExecuteCommandLists batch that holds a list whose Close failed, as
D3D12 must not be given one. resolve_and_read recorded the clears, the resolve and the read-back copy in one
list, so a refused resolve now took the clears and the copy with it and the eight refused cases read back an
unwritten buffer: "refused D24S8 depth AVERAGE rect 1: Close 0x80070057, destination changed" and seven more.
The resolve is now a list of its own between a setup list (clears, edge draw, barriers) and a copy list
(barrier, read-back). Each runs as its own batch, so the layer refuses only the resolve and the test checks
that the destination keeps its clears. The host path is unchanged: a resolve whose Close fails is still never
executed there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A draw that hung past subprocess.run's 120 s timeout raised TimeoutExpired out
of main(), so a multi-fixture run ended in a traceback and never reported the
fixtures after it. main() now reports "vk_harness timed out after 120 s" for
that fixture, goes on, and still exits 1. The test drives main() and check()
with a vk_harness that times out on its first call.
Fixes old #9764
src/root_signature.h says it compiles on Linux CI, and src/host_cpu.cpp
already has its non-Windows branches (cpuid.h, getenv), but both tests
were inside the Windows-only block of runtime/CMakeLists.txt, so Linux
and macOS never ran them. They now build everywhere. MSVC keeps its /W4
/permissive- /utf-8 and /OPT:NOREF; host_cpu_test sets
LEONIDA_SKIP_CPU_CHECK with setenv/unsetenv off Windows.
On Ubuntu 26.04 with gcc 15.2 and clang 21.1: root_signature 56/56
checks pass, host_cpu all pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b95925cbf (all-zero checksum accepted, as host d3d12.dll does) and c297bb577/5c3487a94 (strict checksum,
fail closed on a malformed chunk table) changed copy_rts0_blob_clear_xbox_flags in parallel. Merge 1e029d6df
kept the strict early checksum from one and the loop from the other, so:
- an all-zero-checksum Xbox blob was rejected before the zero-aware check ran: root_sig_test fails on main
("blob helper rewrites an all-zero-checksum Xbox blob and keeps its zero checksum", "shim deserializer
accepts an all-zero-checksum Xbox blob with the high byte cleared");
- the chunk loop skipped malformed entries instead of failing, dropped the RTS0 version check, and left
min_chunk_off unused.
The function now has 5c3487a94's fail-closed chunk walk and RTS0 version check, with b95925cbf's rule: an
all-zero checksum is accepted and stays zero after the rewrite; any other checksum must match. The duplicate
total_size and checksum checks inside the loop are gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3ce953ae8 made CommandList::clear_depth_stencil record a depth outside [0, 1] as given, matching WARP, and
updated command_list_test, d3d12_clear_test and d3d12_close_parity_test, but d3d12_com_test still expected
Close to return E_INVALIDARG for ClearDepthStencilView(depth 2.0), so it fails on main:
"line 345: list->Close() == E_INVALIDARG". It now expects S_OK, as the close-parity rows do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ShaderLibrary::load read the main index plus fspx/ and bvh/, but not library/index.json, where the pipeline library's compute programs are translated. Slot-67 FSPX lookups therefore found no entry for those programs even when the index existed.
Read library/index.json as an optional sub-index and count its entries with the FSPX ones. Add regression coverage for fspx/-before-library/ ordering, code/state lookup, and absent or malformed library indexes.
proxy_create_descriptor_heap treated a readable, non-zero word after the PC
description as a console address. A normal 16-byte D3D12_DESCRIPTOR_HEAP_DESC
is almost always followed by readable, non-zero memory, so every ordinary heap
from a proxy device entered the console path and reported garbage as its CPU
handle; the first Create*View then wrote through it.
The console layout also carries a size, and that size is 32 bytes per
descriptor. Requiring it makes the two layouts distinguishable without guessing
at the address: a PC desc's trailing word is whatever the caller happens to
hold next, and it does not encode NumDescriptors * 32.
Measured on Windows 11, MSVC 14.44.35207, RTX 5070 Ti: ctest 278/300 -> 296/300,
22 failed -> 4 failed. d3d12_descriptor exits 139 before and 0 after; the four
remaining failures (root_sig, d3d12_com, d3d12_vulkan_device, d3d12_depth_resolve)
are unrelated shim behaviour and fail either way.