Commit Graph

159 Commits

Author SHA1 Message Date
150b753449 Merge main into RT-SLOT61 (#383)
One conflict, in docs/d3d12_vulkan.md: both sides added a row to the same
table. Both are kept, in slot order: this branch's "Device slot 61" row,
then main's "Device slot 81, queue PresentX/SuspendX/ResumeX" row.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 17:55:46 -05:00
438859b525 Merge main into RT-SLOT41 (#377)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 17:15:39 -05:00
94f2773c1f Merge main into RT-XMEM-LEASE (#375)
One conflict, runtime/test/xs_proxy_mock_test.cpp, neighbours added on both
sides, both kept: the mock's `held` (this branch, slot 5 private data for the
committed-resource leases) next to main's `max_level` (FEATURE_LEVELS answer),
and this branch's five checks in main()'s list before main's
check_presentation_wiring().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 15:51:38 -05:00
273b3bdf9d [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD)
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.

Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.

Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.

Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.

No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:42:12 -06:00
f2268abead d3d12_xs: queue slot 31 is CopyPageMappingsBatchX, mapped through xmem (RT-QUEUE31)
The retail title calls its command queue's slot 31 (game_scarlett_master.exe+0xf2cc7f) with a batch count, 24-byte
batches {destination, range count, ranges}, the base and page count of its physical-page pool, and 0. Each 12-byte
range {kind, start, count} maps pool pages at the destination: 0 a run, 1 one page repeated, 2 unmapped, 3 unchanged.
main refused the slot with E_NOTIMPL; the title does not test the result and goes on to read the destinations.

Each range now reaches rt::xmem::copy_page_mappings_fn, which maps the physical page behind every source page at its
destination page (a second view of the same section, so both addresses are one memory) and unmaps where the source has
nothing or the kind is 2. The hook is set by xmem.cpp; tests that compile the proxy alone keep the old refusal.

Tests: xmem_test (a run, one page repeated, an unmapped source page, a null source, an overlapping range, bad
addresses) and xs_proxy_mock_test (the four kinds, a range past the pool, an unknown kind, xmem refusing, no xmem).

AI-assisted.
2026-11-24 15:58:40 +00:00
245c959ea0 d3d12_xs: ask the host D3D12CreateDevice for feature level 11_0 (BL-2)
The host path of D3D12XboxCreateDevice asked the PC D3D12CreateDevice for
minimum feature level 12_0, which a comment called the least restrictive
floor. It is the other way round: the minimum refuses every adapter below
it, so a host that tops out at 11_x failed with E_INVALIDARG
(docs/boot_leads.md BL-2). rt::d3d12_xs::create_host_device asks for
kHostDeviceFloor = 11_0, the lowest level D3D12 creates a device at; the
device keeps its highest level, which FEATURE_LEVELS reports and the log
prints (max_feature_level).

xs_proxy_mock_test drives it with mock hosts that top out at 11_0, 11_1,
12_0, 12_1 and 12_2. Each one is created at 11_0, the device proxy's slot
13 reports the host's own top level, and the failure paths (no host
function, failing host, S_OK with no device) clear the output. With 12_0
as the floor the 11_x hosts fail. The Vulkan-backed device takes no feature
level and stays at 12_1 (no ray tracing tier, no sampler feedback).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 20:10:05 +05:00
00fc275459 Keep the Xbox list contract and explicitly managed presentation routing distinct
The known Xbox list interface can wrap a base desktop list and checks each forwarded slot. Detaching a managed presenter no longer falls back to a second window. Reset the integrated list counters with the rest of the device diagnostics.
2026-11-24 23:03:55 +08:00
2d9987f3cd Merge the upstream offline services, frame events and queue ABI into the Windows UI integration
Retain the first-run origin-token poll and shared tokens alongside standard origin, vblank and flip events. Route attached presenter callbacks before the fallback window and dispatch local speech through the Windows provider with the upstream offline fallback.

The offline pipeline checker now enables the runtime mesh query feature for cache-producing runs. A controlled GPU comparison with the same compute shader changed from a miss to an application cache hit.
2026-11-24 22:51:02 +08:00
e9a13181f4 d3d12_xs: route device slots 86, 101, and 108 to PC Device2/Device5/Device8
Reopened from #7201 (closed in the PR reset), rebased on current main.

Slot 86 (CreatePipelineState stream) -> PC slot 47, slot 101
(CreateStateObject) -> PC slot 62, slot 108 (GetResourceAllocationInfo2)
-> PC slot 68. Slot 108 accepts the console C-ABI order (return buffer
first) and the PC order, reads the title's 56-byte D3D12_RESOURCE_DESC
entries, expands each into a zeroed D3D12_RESOURCE_DESC1, normalizes
Xbox layout words and flag bits, and refuses a count with a null array.

Rebase: kept main's slot 133 (CreatePlacedResourceX) next to the new
slots, and slot 108 now masks flags with slot 133's PC set (0x5FF, which
keeps USE_TIGHT_ALIGNMENT and drops 0x200) instead of 0x1FF.

(cherry picked from commit 1b07215c84)
2026-11-24 18:43:05 +04:00
e59cc2e655 Distinguish desktop and Xbox feature queries while retaining the D16/S8 paths
Keep the desktop HRESULTs for Xbox-only formats. Check both console and desktop vtable callers in the mock, and exercise the full rectangle target for a derived PSO with a zero sample mask.
2026-11-24 21:46:19 +08:00
89e0ea9b55 Merge pull request #402 from ubiquitarianism/feat/xs-frame-pacing-presentx
d3d12_xs: add multi-event FramePacer TOKEN_ON_TIMEOUT and wire XboxPresentation to device/queue slots (RT-XS-FRAME-PACING-PRESENTX)
2026-11-24 08:44:42 -05:00
d52ab6b5b3 d3d12_xs_device: map only the measured console list IID at slot 73
The slot 73 fallback retried every IID the PC device refused, so asking for
a public list revision the backend lacks (ID3D12GraphicsCommandList9 on a
revision-8 device) returned S_OK and a base list instead of E_NOINTERFACE
(review on #359). Only the console ID3D12GraphicsCommandListX IID
{c3827890-4024-474c-98cf-645b51dc4874} (#445) is now created as
ID3D12GraphicsCommandList, in one call, and the list proxy answers
QueryInterface for it. Every other IID reaches the device unchanged.

Tested: xs_proxy_mock (List9 and an unknown IID keep E_NOINTERFACE with a
null output; the console IID is created once and is queryable) and
d3d12_vulkan_device with MSVC 14.44 / SDK 10.0.26100; docs tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 08:15:02 -03:00
028a414fad d3d12_xs: the title's queue slots 16 and 17 with a fence are Signal and Wait
Queue slots 16 and 17 are GetTimestampFrequency(UINT64*) and GetClockCalibration(UINT64*, UINT64*) on the PC:
both write through their first argument. The retail title calls slot 16 with one of its fences and a value, the
shape of Signal(fence, value). On the console queue Signal and Wait sit two later than on the PC, at 16 and 17,
as the frequency getter does at 18. Forwarded by number, the call wrote the frequency over the first word of
the fence proxy, its vtable pointer; the title's next call on that fence went through a null pointer.

The title's call (set_console_caller) whose first argument is a fence proxy now goes to the PC Signal or Wait
with the real fence. A host caller keeps the PC getters, and so does a title call whose first argument is no
object of this proxy, which cannot be a Signal.

Same family as the slot 18 change: the console queue order of old PR 2490 (Nolan Cotter), as one rule for
main's queue proxy. xs_proxy_mock_test: both slots with a fence reach the mock queue's slots 14 and 15 with the
real fence, the fence proxy's first word is unchanged, and the non-fence and host calls reach slot 16.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
2026-11-24 03:52:42 -06:00
862890c893 d3d12_xs: the title's queue slot 18 is the frequency getter, not PC GetDesc
Queue slot 18 is ID3D12CommandQueue::GetDesc on the PC: a struct return that writes a 16-byte description through
the hidden pointer. The retail title calls slot 18 with one pointer to 8 bytes, the shape of
GetTimestampFrequency(UINT64*), which the console queue has there (two methods are inserted at 14/15, so the PC
slots 16 to 18 sit two later). Forwarded as GetDesc, the call wrote a description over the title's 8 bytes and
what follows them; the title then went wrong a little later, after its first submission.

The title's call (set_console_caller, as device slots 61 and 74) now goes to the PC slot 16. A host caller, and
every caller when no classifier is installed, keeps the PC GetDesc.

The reading of slot 18 is that of the console queue work in old PR 2490 (Nolan Cotter), which answers an
undetected slot 18 as the frequency getter because it is the only reading that cannot overrun its argument. That
work's layout detection does not apply to main's queue proxy; this is the one rule the boot needs, written for
it. xs_proxy_mock_test: the guest call reaches the mock queue's slot 16 with its pointer and leaves the words
around it; a host call, with a classifier and with none, reaches slot 18.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
2026-11-24 03:52:42 -06:00
adc4f314ba d3d12_xs: the list proxy translates title-owned CPU descriptor handles (console list slots 50 to 54)
Device slots 17 to 24 translate a CPU descriptor handle in the title's own range (__XMemAllocationHooks__) to
the real heap's. The five command-list methods that take such handles did not: OMSetRenderTargets (console slot
50), ClearDepthStencilView (51), ClearRenderTargetView (52) and the two ClearUnorderedAccessView (53, 54) went
to the real list with the title's address, which is no descriptor there. On the retail boot the first
ClearRenderTargetView made the list's Close fail.

They translate now, in copies: the caller's arrays are not written, and a handle outside the range is passed as
it is. Slot 51 gets a typed thunk, because its depth is a FLOAT in XMM3, which the all-integer list thunk loses.

This is 0aba6c361 (LeonidaBringup) written again for main's list proxy, where that commit does not apply (it
sits on old PR 2490's list proxy). xs_proxy_mock_test: the five slots with a handle inside the range, one
outside it, and the caller's arrays unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
2026-11-24 03:52:42 -06:00
54ed404def d3d12_xs: console list slot 139 is Reset, routed to the PC slot 10
The retail title resets its command lists through list slot 139, with (allocator proxy, pipeline state). main's
slot map had no entry for it, so the call was recorded and dropped and the list stayed closed. The map sends it
to the PC slot 10, and the unwrap keys on the PC slot, so console slot 10 and console slot 139 both hand the real
list its real allocator (and a wrapped pipeline state the same way) and re-pin the inline cursor.

The mapping and the unwrap rule are those of ef9d0759d (Nolan Cotter; measured by Pipodi), written again for
main's list proxy, where that commit does not apply. xs_proxy_mock_test checks the map entry and a slot 139 call.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
2026-11-24 03:52:41 -06:00
1bd72a87ad d3d12_xs: route command queue slot 35 to ExecuteCommandLists
(cherry picked from commit e925b63455)

Adapted to main by Mumogg: main has command-list proxies, so the shared execute function replaces them by their
real lists in a copy of the array (UnwrappedArray), for the console slot 35 as for the PC slot 10, whose test
failed otherwise. The slot 35 mock case passes two mock lists instead of two numbers and checks that they arrive
and that the caller's array is not written.
2026-11-24 03:52:41 -06:00
bbae96de2a d3d12_xs: handle ID3D12CommandAllocator slot 9 (SetAllocatorCallbackX) on allocator proxy
(cherry picked from commit e29e989980)
2026-11-24 03:52:41 -06:00
ad9edee610 d3d12_xs: slot 74's stand-in is for the title's calls; a host caller gets PC ShaderCacheControl
The stand-in also took a host's ID3D12Device9::ShaderCacheControl call through the proxy and answered S_OK
without reaching the device (found on native Windows by BadgersMC in the review of this change). Slot 74 now
asks the caller classifier slot 61 uses (set_console_caller): a caller in an image the guest loader mapped gets
the stand-in, any other caller, and every caller when no classifier is installed, is forwarded to the PC slot 74
or refused past the PC device's table.

xs_proxy_mock_test: the guest case under a classifier, and the host case with a classifier and with none, on a
device that has ShaderCacheControl and on one that does not.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
2026-11-24 03:52:20 -06:00
49fd9a4275 d3d12_xs: slot 61 is CreateSamplerX only for the title's calls; a host caller gets PC CreateMetaCommand
The proxy also serves host callers: d3d12_vulkan_device_test drives the Vulkan device through it,
and its ID3D12Device5::CreateMetaCommand call (PC slot 61) landed in proxy_create_sampler_x
(found by nullmarsh on #7115: the test stopped at line 5763 instead of main's known line 6574).

Slot 61 now checks the caller's return address with a classifier the runtime installs
(set_console_caller, the name #7490 uses): D3D12XboxCreateDevice installs
rt::shims::mapped_image_base, so only a caller in an image the guest loader mapped gets
CreateSamplerX. Any other caller, and every caller when no classifier is installed, is forwarded
to the PC slot 61.

xs_proxy_mock_test checks all three cases: no classifier (PC slot 61), a guest caller (PC
CreateSampler with the same words; a null description skipped) and a host caller under an
installed classifier (PC slot 61). d3d12_vulkan_device_test again stops at line 6574, as on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8f756ebe048af042638ce51a61490f35f4f44ee3)
(cherry picked from commit c915e1da45)
2026-11-24 03:52:20 -06:00
f22b85e697 d3d12_xs: device slot 74 (pointer, u32, pointer) returns S_OK instead of reaching PC ShaderCacheControl (#7231)
The retail title calls slot 74 once; the PC slot 74 reads the first pointer as kinds and returns E_INVALIDARG, so the title hits an int3. The proxy handler does not call the PC device, writes nothing, logs the three words once, and yields to an env slot override that moves a route onto 74.

(cherry picked from commit cdeee35aa8)

Adapted to main by Mumogg: the queue route inside route_xbox_device_slot calls proxy_create_command_queue_xbox
(the 32-byte description of 0cde63d61), as the inline route did before this commit moved the routes into a
function.
2026-11-24 03:52:20 -06:00
99ba1c085f d3d12_xs: Xbox device slot 61 is CreateSamplerX, routed to the PC CreateSampler
The retail title calls device slot 61 as CreateSamplerX(desc, dest handle), once
per sampler, after its descriptor heaps exist (stop 20 of the RT-5 boot
measurements in the coordination issue). The generic thunk forwarded it to the
PC slot 61, which is CreateMetaCommand, so the sampler was never written.

Slot 61 now has its own handler, like 62 and 67. It passes the description's
PC D3D12_SAMPLER_DESC prefix and the handle to the PC CreateSampler (slot 22).
That was enough to get the title past this call under Wine. Whatever follows
the prefix in the console description is not known and is not read. A null
description is skipped and logged once. A handle in the title's own heap range
is #7021's translation.

xs_proxy_mock_test: slot 61 reaches the mock's slot 22 with the same two words
and never its slot 61; a null description reaches nothing. With main's
d3d12_xs_device.cpp the new check fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit e22994464b)
2026-11-24 03:52:20 -06:00
69b46dfccb d3d12_xs: read the console argument type as its 32 bits (clang-cl)
105 is outside D3D12_INDIRECT_ARGUMENT_TYPE's range [0, 15], so clang-cl
rejects a constant expression that casts it to the enum (reported by
umnitus on #7163). The handler now reads each argument's Type field as a
uint32_t through memcpy and compares it with 105; the test writes and reads
the raw value the same way, and the mock records it the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 084c8c60e7)
2026-11-24 03:52:20 -06:00
c8247cdfa3 d3d12_xs: a console indirect argument of type 105 is created as DISPATCH (slot 41)
The retail title creates five one-argument command signatures with no root
signature at startup (device slot 41, CreateCommandSignature at its PC
position). One has the console argument type 105 and a 12-byte stride, next
to a DISPATCH and a DISPATCH_MESH of 12 bytes. The PC layer refuses the
unknown type, which is stop 19 of the RT-5 boot measurements.

Read statically from the title's call sites (shapes only): the two
ExecuteIndirect sites of that signature pass MaxCommandCount 1 and an offset
into the same argument buffer as the DISPATCH sites. Right before, they set
the same compute state as the DISPATCH path (pipeline, compute root signature,
tables, constants, SRV and UAV); they record on a second command list of the
title's context. So the argument is taken as a D3D12_DISPATCH_ARGUMENTS.

Slot 41 now has its own handler. A description that holds type 105 is copied
with that type replaced by DISPATCH (logged once). Any other description is
forwarded as the same pointer. What the console does differently for type 105
is left open in docs/d3d12_vulkan.md (section 4.9).

xs_proxy_mock_test: a two-argument description (a root constant, then type
105) reaches the PC slot 41 as a copy with DISPATCH, the same stride, count,
root signature, IID and output, and the caller's description is untouched; a
PC description is passed through unchanged. With main's d3d12_xs_device.cpp
the new check fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4c04c0f4e3)
2026-11-24 03:52:20 -06:00
c108c53894 d3d12_xs: the console render-target sizes of slots 25 and 56 are for console-form calls only
With the console tile sizes applied to every caller, a PC-form call through the proxy no longer answered what the
PC device answers, and the code that compares the two failed on Windows: device_proxy_test's two slot 25 checks
and d3d12_vulkan_device_test's allocation_mismatches (reported on #375 from MSVC builds on AMD and NVIDIA, the
first bad commit being the one that cleans the descriptions). Together with b4d1ba179, which scopes the cleaning
the same way, a PC-form caller now gets the PC device's own answer for its own description; the title's call,
which comes in the console form, gets the cleaned description and the console sizes as before.

xs_proxy_mock_test: the PC-form slot 25 case expects the mock device's size (it expected the console size), and
the mixed slot 56 case is asked in the console form. device_proxy_test includes d3d12_xs_desc_clean.h for the
cleaned description b4d1ba179's check compares with.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
2026-11-24 03:49:26 -06:00
24914e7298 d3d12: preserve PC descriptor validation in slot 25
(cherry picked from commit b4d1ba1794)
2026-11-24 03:48:25 -06:00
e090be908d d3d12_xs: committed resources lease their size through the title's XMem hooks (RT-5 stop 17)
On the console a committed resource's memory is allocated with XMemAlloc, so it goes
through the title's __XMemAllocationHooks__. The retail title budgets its first
full-screen render targets with a per-thread hook that bump-allocates out of a range it
reserved and asserts that less than 2 MiB is left; PC resources never allocated through
the hooks, so the assert always fired. Slots 76 and 127 now allocate the slot-25 size of
each resource through the hooks, held by the resource with SetPrivateDataInterface and
freed when it is destroyed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit ae322dafc5)

Adapted to main by Mumogg: the lease size is the later form of this series (d61755d4d, a render target's console
tile size, else the PC size), since console_render_target_extra is gone after 359390833.
2026-11-24 03:47:22 -06:00
8eaccded7f d3d12_xs: console render target sizes follow each resource's alignment, slot 56 offsets, full mip chains, rounded-up mip extents, B5G5R5A1, saturating sums
(cherry picked from commit 359390833f)
2026-11-24 03:47:22 -06:00
6b75cbafbc d3d12_xs: device slot 25 gives the PC device clean resource descriptions (RT-5 stop 16)
The title's descriptions carry the Xbox layout word and flag bits above the PC ones. Slot 25 now passes a copy with PC flags and a PC layout; the title's array is not written. Depends on #7078.

(cherry picked from commit c7ca0f2d1c)
2026-11-24 03:47:22 -06:00
f59167ef9c d3d12_xs: device slot 25 pads a render target to whole console tiles (RT-5 stop 17)
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)
2026-11-24 03:47:22 -06:00
522faa2ee4 d3d12_xs: honour __XMemAllocationHooks__ for descriptor heaps and translate CPU handles
(cherry picked from commit 355201c51e)
2026-11-24 03:47:22 -06:00
2a3e7a23ea d3d12_xs: route presentation slots safely, hold the handler across calls
- Queue routes: PresentX defaults to slot 30 (XCL's older layout; 32 is the
  newer one, set with LEONIDA_XS_PRESENT_X_SLOT). SuspendX/ResumeX slots are
  unmeasured, so they are routed only when their variables are set; two
  routes on one slot are refused with a log instead of shadowing each other.
- One env_slot() parser for device and queue slots (no duplicated copy).
- GetFrameStatisticsX is a route like 78-80 (LEONIDA_XS_FRAME_STATISTICS_SLOT,
  default 81). Without a presenter it answers S_FALSE with a zero count
  instead of reaching PC slot 81 (ID3D12Device13::OpenExistingHeapFromAddress1).
- The presentation handler is called with its lock held shared, so a detach
  cannot destroy the presenter under an in-flight call.
- frame_pacer.h: the new event/flag constants are marked provisional again.
- xbox_present.h: attach_xbox_presentation is documented as the seam the
  presenter will use; gta6rt does not create an XboxPresentation yet.

AI-assisted. Tested with clang 23 / mingw x64: xs_proxy_mock_test (all checks
but the pre-existing kLong allocation-injection ones, which also fail on main
under mingw), --env-slots, --env-slots-invalid, frame_pacer_test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 03:11:24 -03:00
7aa5d60ae3 Merge remote-tracking branch 'ubiq/main' into feat/xs-frame-pacing-presentx
# Conflicts:
#	runtime/test/xs_proxy_mock_test.cpp
2026-11-24 03:03:24 -03:00
f423c90462 d3d12_xs_device: slot 73 retries a console list IID as ID3D12GraphicsCommandList
Reduced to what main does not already have: slots 25/26 (struct return) and
48 (queue desc sanitize) landed on main, and the slot 58 forwarder is dropped
(PC vtable slot 58 is ID3D12Device5::RemoveDevice, not
GetResourceAllocationInfo1, and no call to Xbox slot 58 is measured).

CreateCommandListX passes the title's console command-list IID, which the PC
device does not know (docs/retail_boot_chain.md 3.3). On E_NOINTERFACE for an
IID that is not a PC list IID, create the list once more as
ID3D12GraphicsCommandList and hand out the console list proxy. A PC list IID
the device refuses still fails as before.

AI-assisted. Tested: xs_proxy_mock_test new checks with clang 23 / mingw x64
(a pre-existing kLong allocation-injection check does not fire under mingw, so
the full run needs MSVC/CI).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 03:03:10 -03:00
ddafa07b46 d3d12_xs: multi-event FramePacer TOKEN_ON_TIMEOUT and XboxPresentation proxy wiring
- Support origin (0), vblank (1), and flip (2) frame events and
  frame_wait_flag_token_on_timeout (flag 2, returning S_FALSE with a
  fresh consecutive token on timeout) in runtime/src/frame_pacer.h.
- Add a decoupled PresentationHandler interface to d3d12_xs_device.{h,cpp}
  routing device slots 78-81 and queue PresentX/SuspendX/ResumeX slots
  (default 30/31/32, env-overridable via LEONIDA_XS_*_SLOT).
- Add attach_xbox_presentation / detach_xbox_presentation in
  runtime/shims/xbox_present.{h,cpp}.
2026-11-24 01:43:53 -03:00
81e8a6f2a4 d3d12_xs: device slot 127 creates the committed resource (CreateCommittedResource3 with Xbox descriptors, RT-5 stop 15)
Slot 127 is past the PC device vtable and was refused with E_NOTIMPL. It has the argument list of ID3D12Device10::CreateCommittedResource3; the proxy now calls the PC device's with the Xbox layout word and flag bits cleaned as slot 76 does. Measured in #6982.

(cherry picked from commit 8d622049ae)
2026-11-23 22:14:29 -06:00
9bc1f8f1a8 xs_proxy_mock_test: device slot 25 in the console's form and the PC's
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
2026-11-23 21:54:57 -06:00
f9d20bf9b0 d3d12_xs: Xbox device slot 70 writes a null shader-resource view instead of reaching PC CreatePlacedResource1 (retail boot chain stop 14)
(cherry picked from commit 3073250df5)
2026-11-23 21:52:25 -06:00
9e6f8ae133 d3d12_xs: device slot 48 creates a command queue proxy from the 32-byte Xbox description
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.
2026-11-23 21:48:33 -06:00
c4954581ae d3d12_xs: device slot 26 takes the console's struct-return form
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)
2026-11-23 21:46:43 -06:00
74bf391fda merge follow-up: the test tree builds again
- 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
2026-11-23 20:46:46 -06:00
1a04df0b1b Merge main (9ec34cdff) into the frame-loop boot stack
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
2026-11-23 20:42:04 -06:00
868002b0d8 Merge remote-tracking branch 'origin/pr/9745' 2026-11-23 17:24:48 -05:00
cb29a2b88f d3d12_xs: slot 133 commits the buffer's xmem pages before the host-pointer import
xmem commits physical pages on first touch (#7556), so a range the title has
mapped but not written yet is still MEM_RESERVE when it places a buffer on it
through device slot 133, and the Vulkan layer's import (#7218) refuses reserved
pages and answers with its fallback buffer, which the title's writes never reach.

Slot 133 now calls a registered pages hook (set_placed_at_va_pages_hook, next to
set_placed_at_va_handler) with the buffer's range before the handler; gta6rt
registers rt::xmem::commit_physical_range. A failed commit is logged once and the
handler still runs. Textures don't call it. The Vulkan layer doesn't link xmem.

Tests: xs_proxy_mock_test checks the hook order, arguments, failure and texture
cases; the new d3d12_xmem_placed_test places a buffer on untouched xmem physical
pages and checks the fallback without the hook, and with it the import and a GPU
copy reading the CPU's writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:51:49 -03:00
d90903a631 d3d12_xs: implement console ListProxy with cursor pinning and queue unwrapping
- Implement ListProxy for Xbox-ABI command lists returned by slot 73
  (CreateCommandListX) with 160-slot vtable and inline cursor pinned to limit
- Keep slot 12 (CreateCommandList) returning unwrapped PC-shaped list so
  desktop test harnesses (run_tiny_frame, tiny_frame.cpp) keep slot 48
  (ClearRenderTargetView) working without regression
- Route console command list slots:
  * 0..26: PC order
  * 27..30: unforwarded console extras
  * 31: ExecuteBundle (unwraps bundle command list proxy)
  * 32: SetDescriptorHeaps (unwraps heap proxies via UnwrappedArray)
  * 33..59: shifted +4 to PC slots 29..55
  * 60: EndEvent -> PC slot 58
  * 61: ExecuteIndirect -> PC slot 59
  * 85: CopyTextureRegionX -> PC slot 16
  * 146: Barrier -> PC slot 80 (ID3D12GraphicsCommandList7)
  * 148: AllocateUploadMemory stub (returns null, logged once)
  * 10: Reset unwraps allocator proxy and re-pins inline cursor
- Unwrap command list proxies in queue slot 10 (ExecuteCommandLists)
- Add comprehensive mock tests verifying routing, pinning, and unwrapping
2026-11-23 21:09:38 +01:00
7b2054b38a ladder: kXboxFlag is const, not constexpr (clang rejects 0x20000 for the unfixed enum; aapolipponen)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:00:25 +01:00
bd6b147b16 Merge branch 'pr7880' into ladder-frame
# Conflicts:
#	runtime/shims/d3d12_xs_device.cpp
#	runtime/shims/d3d12_xs_device.h
#	runtime/test/xs_proxy_mock_test.cpp
2026-11-23 19:55:34 +01:00
57a0fc4caf d3d12_xs: declare console_to_pc_list_slot and verify slot mapping 2026-11-23 19:48:12 +01:00
0b88239f90 Merge branch 'pr7949' into ladder-frame
# Conflicts:
#	runtime/shims/d3d12_xs_device.cpp
2026-11-23 19:33:47 +01:00
a3ed44ca30 Merge branch 'pr7290' into ladder-frame
# Conflicts:
#	runtime/shims/d3d12_xs_device.cpp
#	runtime/shims/d3d12_xs_device.h
#	runtime/test/queue_proxy_test.cpp
#	runtime/test/xs_proxy_mock_test.cpp
2026-11-23 19:31:52 +01:00