Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
522faa2
d3d12_xs: honour __XMemAllocationHooks__ for descriptor heaps and tra…
Khuraie Nov 23, 2026
f59167e
d3d12_xs: device slot 25 pads a render target to whole console tiles …
tedin7 Nov 23, 2026
6b75cba
d3d12_xs: device slot 25 gives the PC device clean resource descripti…
tedin7 Nov 23, 2026
8eaccde
d3d12_xs: console render target sizes follow each resource's alignmen…
tedin7 Nov 23, 2026
e090be9
d3d12_xs: committed resources lease their size through the title's XM…
jacksonslab Nov 23, 2026
24914e7
d3d12: preserve PC descriptor validation in slot 25
TripleJ160 Nov 23, 2026
4056d18
ladder: kXboxTiledResourceLayout is inline const, not constexpr (clan…
ASTROWwwW Nov 23, 2026
c108c53
d3d12_xs: the console render-target sizes of slots 25 and 56 are for …
Mumogg Nov 24, 2026
0c5a146
d3d12_xs: the hook-backed descriptor address is not applied to a cons…
Mumogg Nov 24, 2026
c8247cd
d3d12_xs: a console indirect argument of type 105 is created as DISPA…
mrp1no Nov 23, 2026
69b46df
d3d12_xs: read the console argument type as its 32 bits (clang-cl)
mrp1no Nov 23, 2026
d1f8a65
d3d12: CreateCommandSignature creates a DISPATCH_MESH signature on a …
NiiRoZz Nov 23, 2026
88b8dba
d3d12: ExecuteIndirect keeps main's argument validation; DISPATCH_MES…
Mumogg Nov 24, 2026
99ba1c0
d3d12_xs: Xbox device slot 61 is CreateSamplerX, routed to the PC Cre…
mrp1no Nov 23, 2026
49fd9a4
d3d12_xs: slot 61 is CreateSamplerX only for the title's calls; a hos…
mrp1no Nov 23, 2026
484962e
d3d12_xs: CreateSamplerX translates a destination in the title's desc…
Mumogg Nov 24, 2026
f22b85e
d3d12_xs: device slot 74 (pointer, u32, pointer) returns S_OK instead…
tedin7 Nov 23, 2026
ad9edee
d3d12_xs: slot 74's stand-in is for the title's calls; a host caller …
Mumogg Nov 24, 2026
3ca10df
docs: device slot 74's S_OK stand-in has a row in the Xbox-only table
Mumogg Nov 24, 2026
1bd72a8
d3d12_xs: route command queue slot 35 to ExecuteCommandLists
Vadson159 Nov 23, 2026
bbae96d
d3d12_xs: handle ID3D12CommandAllocator slot 9 (SetAllocatorCallbackX…
DevilNine Nov 23, 2026
dfd62d7
docs: the recorded, never-called allocator callback of slot 9 has a r…
Mumogg Nov 24, 2026
54ed404
d3d12_xs: console list slot 139 is Reset, routed to the PC slot 10
Mumogg Nov 24, 2026
862890c
d3d12_xs: the title's queue slot 18 is the frequency getter, not PC G…
Mumogg Nov 24, 2026
8ba15dd
d3d12_xs: the queue's console slot 32 is PresentX, wired to the prese…
Mumogg Nov 24, 2026
af8c42b
PresentX: device-side WaitFrameEventX and the frame pacer share one t…
Cattn Nov 23, 2026
77c801c
queue_proxy_test: the PresentX slot is called and counted
Mumogg Nov 24, 2026
adc4f31
d3d12_xs: the list proxy translates title-owned CPU descriptor handle…
Mumogg Nov 24, 2026
89fdb83
d3d12_xs: a console depth-stencil texture with unordered access is si…
NiiRoZz Nov 23, 2026
cbdaf7e
d3d12_xs: slots 127 and 133 make a depth-stencil texture without unor…
Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions docs/d3d12_vulkan.md
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,30 @@ The trace will enumerate them.
Intel Raptor Lake-S (101.7092) and RTX 5060 Laptop (621.24) hosts wrap, two 2^63 buffers to 0, and WARP on that
PC still saturates. A wrapped total could make a caller allocate less than one of its resources, so the layer
keeps saturating, and the test accepts a host that wraps.
Behind the Xbox-ABI proxy (device slots 25 and 56) a 2D render target of a listed colour format with one sample is
padded to whole console tiles: the size is the sum over its mips (MipLevels 0 is the full chain, an odd extent
rounds up), each mip rounded up to the RDNA2 SW_64KB_D tile shape (`runtime/src/gfx10_tiling.h`: 256 x 128 pixels
for 2-byte elements, 128 x 128 for 4-byte, 128 x 64 for 8-byte, 64 x 64 for 16-byte), with the first mip that fits
in half a tile's width and a whole tile's height, and the mips after it, sharing one tail tile, times the array
size. A 1920 x 1080 RGBA8 target is 135 tiles, 8,847,360 bytes, where the PC answer is 8,323,072. The proxy lays
the descriptions out as the PC device does (each at its own alignment, the total rounded up to the largest
alignment, sums saturating) with each render target at the larger of its console size and its PC size; a 4 MiB
aligned multisampled neighbour therefore keeps its place (a 1 x 1 four-sample target and a 1080p target need 16 MiB,
not 12.5). Slot 56 reports the same offsets. The PC layout stands when no description grows
(`d3d12_xs_alloc_size.h`; `xs_proxy_mock_test`). **Assumption**: the
retail title's own sizes are not measured (#6982, stop 17), so that its allocation is these shapes and no DCC or
CMask memory is open until they are.
The descriptions the title passes to slot 25 carry console values (layout word `0x101`/`0x1`, flag bits above the PC
ones). For console-form calls or descriptors explicitly using layout `0x101`, the proxy strips Xbox-only flags and
translates layout `0x101` to ROW_MAJOR for buffers or UNKNOWN for textures. Other PC-form descriptors reach the host
unchanged for validation (`d3d12_xs_desc_clean.h`; #6982 section 3.7).
A committed resource made through slots 76 and 127 also allocates that size through the title's
`__XMemAllocationHooks__`, as the console runtime's `XMemAlloc` for the resource does, and frees it when the
resource is destroyed (a lease kept with `SetPrivateDataInterface`; the bytes are not used). The retail title
budgets its first full-screen render targets with such a hook: it bump-allocates the allocations whose XALLOC
page-size field is 2 out of a range it reserved and asserts that less than 2 MiB is left (RT-5 stop 17). The
lease's attribute word (allocator ID 0x80, page-size field 2, object type 0) is an **assumption**; the measured
hook reads only the page-size field.
- `GetAdapterLuid` (implemented): `VkPhysicalDeviceIDProperties::deviceLUID`, which on Windows is the DXGI
adapter's LUID; `d3d12_fence_timing_test` finds it with `IDXGIFactory4::EnumAdapterByLuid` (RTX 4090, driver
621.14). A driver that reports `deviceLUIDValid = VK_FALSE` gets a zero LUID, logged.
Expand All @@ -2263,8 +2287,9 @@ The trace will enumerate them.
RDX, node mask in R8 and heap type in R9: three calls right after device creation, node mask 1 and types 1, 2
and 3 (measured under `gta6rt --run` with a register probe in the slot's thunk). A PC C++ method has the device
in RCX and the buffer in RDX, so the Xbox-ABI proxy takes the console form when RDX holds the proxy
(`d3d12_xs_device.cpp`; `xs_proxy_mock_test`, `device_proxy_test`). Slots 25 and 43 return structs too; the
executable has not been seen calling them yet, so the proxy still forwards them in the PC form.
(`d3d12_xs_device.cpp`; `xs_proxy_mock_test`, `device_proxy_test`). Slot 43 returns a struct too and the
proxy still forwards it in the PC form: no call of slot 43 has been seen. Slots 25 and 56 take the same form by the
same rule (reported later in the boot, #6982; not measured), as #6973 first did for slot 25.
- Residency and power (D3D-33) are no-ops that still check their arguments (`d3d12_vulkan_device.cpp`, tested in
`d3d12_vulkan_device_test`). Vulkan has no residency API: memory from `vkAllocateMemory` stays usable until
`vkFreeMemory`, and paging under pressure is the kernel driver's job, so every pageable object is always resident.
Expand Down Expand Up @@ -3506,6 +3531,10 @@ to be recovered from call sites (or the NDA GDK headers, if a developer has acce
| DCC / texture compatibility | Public release note for `D3D12XBOX_RESOURCE_FLAG_FORCE_TEXTURE_COMPATIBILITY` | Let Vulkan choose compression; fail if the game aliases/reads raw compressed data. |
| PresentX / present planes / frame events | Public GDK samples (MIT/zlib), §4.5 | Likely the only present path of a GDKX title. Presenter + vblank-timed frame events; 1-2 planes composed into the Vulkan swapchain (placement, filter, alpha overlay, HDR10 conversions). Call shapes known; slots/layouts **Open**. |
| Device slots 48/73/78/79/80 | Public HLE `Freminet`/`ScarlettX` (third-party, not Microsoft documentation) | `d3d12_xs_device.cpp` routes `CreateCommandQueueX` (48), `CreateCommandListX` (73), `SetFrameIntervalX` (78), `ScheduleFrameEventX` (79) and `WaitFrameEventX` (80) before it indexes the PC vtable. Queue and list creation use the existing create paths. The frame-event calls are a per-device token counter: `WaitFrameEventX` returns at once with a fresh non-zero token, because there is no vblank source before a presenter exists. The five indices can be moved with `LEONIDA_XS_QUEUE_X_SLOT`, `LEONIDA_XS_LIST_X_SLOT`, `LEONIDA_XS_FRAME_INTERVAL_SLOT`, `LEONIDA_XS_SCHEDULE_EVENT_SLOT` and `LEONIDA_XS_WAIT_EVENT_SLOT` (3..127; a value that names a slot the proxy already handles keeps that slot's handler); a trace that disagrees wins. |
| Indirect argument type 105 | The retail title's startup creates five one-argument command signatures (device slot 41) with no root signature; one has type 105 and a 12-byte stride. Its two `ExecuteIndirect` sites, read statically, set the compute state first, as the `DISPATCH` sites do, and pass one command from the same argument buffer, on a second command list | `d3d12_xs_device.cpp` creates it as `DISPATCH` (`D3D12_DISPATCH_ARGUMENTS`). What the console does differently for it is **Open**. |
| Device slot 61 | The retail title's boot under `gta6rt --run` (stop 20 of the RT-5 measurements in #6910): called as `(desc, dest handle)` once per sampler | `d3d12_xs_device.cpp` routes it to the PC `CreateSampler` (slot 22) with the description's PC `D3D12_SAMPLER_DESC` prefix, for a caller in an image the guest loader mapped; the PC slot 61 is `CreateMetaCommand`, which any other caller (a host test driving the device through the proxy) still gets. The layout of the description beyond the PC fields is **Open**. |
| Device slot 74 | The retail title's boot under `gta6rt --run`: called as `(pointer, u32, pointer)` | **Stand-in.** `d3d12_xs_device.cpp` answers `S_OK` and does nothing, for a caller in an image the guest loader mapped; the PC slot 74 is `ShaderCacheControl`, which the call does not fit and which any other caller still gets. What the console method is, and what it should do, is **Open**. |
| Command-allocator slot 9 | The retail title's boot under `gta6rt --run`: called past the 9-slot PC allocator, as `(function pointer, context, ...)`; `SetAllocatorCallbackX` is the name the commit that added it uses | **Stand-in.** The allocator proxy records the callback and its context (`allocator_proxy_callback`, `allocator_proxy_callback_context`) and answers `S_OK`. **Nothing calls the callback**: the Vulkan layer backs command buffers itself. Whether the title depends on being called back is **Open**. |
| VRS | Public `D3D12_SHADING_RATE` / `D3D12_AXIS_SHADING_RATE` | `VK_KHR_fragment_shading_rate`; `RSSetShadingRate`/image-based rate map to `vkCmdSetFragmentShadingRateKHR`. |
| Mesh shader tier | Public `D3D12_MESH_SHADER_TIER` | `VK_EXT_mesh_shader`; the 9,282 translated mesh shaders make this a hard requirement for any content that uses them. |
| Wave MMA | Public `D3D12_WAVE_MMA_TIER` | Not used: no shader sets `WAVE_MMA` in SFI0 and none contains `v_mfma`/`v_wmma` (all 26,503, `tools/feature_scan.py`). Answer the tier query truthfully; no cooperative-matrix mapping is needed. |
Expand Down
1 change: 1 addition & 0 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ if(BUILD_TESTING)
# The routes are read once per process, so each override case is its own test.
add_test(NAME xs_proxy_mock_env_slots COMMAND xs_proxy_mock_test --env-slots)
add_test(NAME xs_proxy_mock_env_slots_invalid COMMAND xs_proxy_mock_test --env-slots-invalid)
add_test(NAME xs_proxy_mock_env_slots_74 COMMAND xs_proxy_mock_test --env-slots-74)
endif()
if(TARGET root_sig_test)
add_test(NAME root_sig COMMAND root_sig_test)
Expand Down
10 changes: 10 additions & 0 deletions runtime/shims/d3d12_com.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,11 +842,21 @@ class GraphicsCommandList final
kind == leonida::IndirectKind::draw ? sizeof(D3D12_DRAW_ARGUMENTS)
: kind == leonida::IndirectKind::draw_indexed ? sizeof(D3D12_DRAW_INDEXED_ARGUMENTS)
: kind == leonida::IndirectKind::dispatch ? sizeof(D3D12_DISPATCH_ARGUMENTS)
: kind == leonida::IndirectKind::dispatch_mesh ? sizeof(D3D12_DISPATCH_MESH_ARGUMENTS)
: 0;
if (!record_size || stride < record_size || stride % 4 != 0) return check(false);
if (argument_buffer_offset > arg_desc.Width ||
UINT64(max_command_count) > (arg_desc.Width - argument_buffer_offset) / stride)
return check(false);
if (kind == leonida::IndirectKind::dispatch_mesh) {
// Not replayed yet (#3777 replays it as vkCmdDrawMeshTasksIndirectEXT): nothing is recorded, and the
// first such call says so. The list stays valid.
static std::atomic<bool> logged{false};
if (!logged.exchange(true, std::memory_order_relaxed))
std::fprintf(stderr, "[rt] d3d12: ExecuteIndirect with a DISPATCH_MESH signature is not replayed yet; "
"nothing was recorded\n");
return;
}
leonida::ExecuteIndirect cmd{};
cmd.kind = kind;
cmd.stride = stride;
Expand Down
5 changes: 5 additions & 0 deletions runtime/shims/d3d12_vulkan_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5833,6 +5833,11 @@ class Device final
case D3D12_INDIRECT_ARGUMENT_TYPE_DRAW: kind = leonida::IndirectKind::draw; break;
case D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED: kind = leonida::IndirectKind::draw_indexed; break;
case D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH: kind = leonida::IndirectKind::dispatch; break;
case D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_MESH:
// As DispatchMesh: only a device with mesh shaders (MeshShaderTier 1) takes it.
if (!state_.info.mesh_shader) return E_NOTIMPL;
kind = leonida::IndirectKind::dispatch_mesh;
break;
default: return E_NOTIMPL;
}
return create_command_signature(kind, desc->ByteStride, riid, out, identity());
Expand Down
17 changes: 17 additions & 0 deletions runtime/shims/d3d12_xs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,22 @@ HRESULT WINAPI create_root_signature_deserializer(const void* data, SIZE_T size,
return fn(data, size, iid, out);
}

void* xmem_descriptor_heap_alloc(std::size_t byte_size, std::uint64_t attributes) {
const rt::shims::XMemAllocationHooks* hooks = rt::shims::xmem_allocation_hooks();
return (hooks && hooks->alloc) ? hooks->alloc(byte_size, attributes) : nullptr;
}

void xmem_descriptor_heap_free(void* ptr, std::uint64_t attributes) {
const rt::shims::XMemAllocationHooks* hooks = rt::shims::xmem_allocation_hooks();
if (hooks && hooks->free) hooks->free(ptr, attributes);
}

// Measured shape: D3D12XboxCreateDevice(adapter, params, riid, out), where params is a 24-word block that is only
// logged and not used to create the device. The struct's total size is unknown, so the log reads 24 x 32-bit words
// (96 bytes) and no more. The PC D3D12CreateDevice needs a minimum feature level instead, so 12_0 is used as the
// least restrictive floor; higher feature levels are still exposed by the created device.
HRESULT WINAPI D3D12XboxCreateDevice(IUnknown* adapter, const void* params, const IID* riid, void** out) {
rt::d3d12_xs::set_default_descriptor_heap_allocator(&xmem_descriptor_heap_alloc, &xmem_descriptor_heap_free);
constexpr auto method = "D3D12XboxCreateDevice";
using rt::d3d12_trace::result;
if (!out) return result(method, E_POINTER);
Expand Down Expand Up @@ -155,6 +166,12 @@ HRESULT WINAPI D3D12XboxCreateDevice(IUnknown* adapter, const void* params, cons
std::fprintf(stderr,
"[rt] d3d12_xs: D3D12XboxCreateDevice: wrapping the PC ID3D12Device in the Xbox-ABI proxy "
"(slot 62 -> CreateComputePipelineState, slot 76 -> CreateCommittedResource).\n");
// A console method whose slot is another PC method (61) is served only to the title: a caller in an image
// this loader mapped.
rt::d3d12_xs::set_console_caller([](std::uint64_t address) {
std::uint64_t base = 0;
return rt::shims::mapped_image_base(address, base);
});
}

#ifdef LEONIDA_VULKAN_DEVICE
Expand Down
Loading
Loading