Commit Graph

20 Commits

Author SHA1 Message Date
66bfad8e1f Merge pull request #1950 from CLHelper 2026-11-22 10:39:41 -05:00
51345fc6b1 docs: the five-word inline dispatch and byte +0x143 of the console list
Section 3.5a names the four-word inline dispatch. The BVH builder also
writes a five-word form, 0x4003cc00, x, 1, 1, W, at 0x14972, 0x15215,
0x1536a and 0x1d002. It is the inline form of console slot 80: when the
buffer is full each site calls +0x280 with the same (x, 1, 1, W). W is
0x8020 at two sites and 0x20 at the other two.

Byte +0x143 is read at 31 sites in the builder and one in the FSR DLL
and written by neither; every store into +0x140..+0x143 is a byte store
to +0x140 or +0x141. A replacement list can leave it 0. The slot-80 row
of section 3.3a points at the packet and the 0x20 calls.
2026-11-22 15:11:45 +00:00
508e94d659 docs/d3d12_command_objects.md: the translator takes 17 of the 29 FSPX programs
The paragraph still said 13, from before the dot-product rule (#1754). docs/fspx.md, "Translation status", has 17
and lists what stops the other 12; the paragraph now points there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:06:06 -05:00
7886972a6b Merge upstream main
# Conflicts:
#	docs/d3d12_command_objects.md
2026-11-22 09:48:41 -05:00
088447e117 FSPX programs: translated by the shaders stage, found at run time by their kind-6 bytes (RT-99)
The FidelityFX DLL creates its compute pipelines from FSPX programs (docs/fspx.md): through slot 67 with the bare
kind-6 program, then through slot 62 with the DXBC container whose ACCC part holds the payload. Both ended in
E_INVALIDARG: the layer took only FSSM bytecode, the build never translated the DLL and the index had no key for it.

- make_game.py: the shaders stage unpacks the package's DLL with tools/fspx_unpack.py --disasm into
  <work>/shaders/fspx and translates it into <work>/shaders/spirv/fspx, with the same wave64 mode and fallback
  flags. The step is redone as a whole when the DLL, its tools, llvm-mc or the flags change (fspx_build.json,
  written last) and never makes the game's shaders run again.
- tools/shader_meta.py: an entry of a program without an FSSM blob gets fspx_code_sha256, the SHA-256 of
  fspx/<name>.code.
- runtime/src/shader_library.h: the library also loads <dir>/fspx/index.json and finds entries by
  fspx_code_sha256. compute_program() takes an FSSM program as before, the kind-6 bytes of an ACCC container or of a
  bare FSPX payload, and a bare kind-6 program recognized by its prologue; the directory is parsed with the DLL
  reader's rules and bounds-checked, so a malformed one is refused.
- create_compute: looks the program up by the key of its kind and uses those bytes as the code base.
- Tests: shader_library_test (parsing, malformed directories, lookup, the fspx folder), d3d12_fspx_compute_test
  (PSOs from both forms, a dispatch each, refused inputs) and tests/test_fspx_shaders_stage.py.
- Docs: the lookup in docs/fspx.md; slots 62 and 67 in d3d12_command_objects.md and d3d12_vulkan.md. The size the
  slot-67 description carries at +0x30 is kind 6's own size, read from the DLL's code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:22:54 -05:00
f61946cfe1 Merge pull request #1795 from AimLogin 2026-11-22 09:15:24 -05:00
2123a02506 Runtime: Xbox-ABI proxy for the command allocator (device slot 9)
Device slot 9 (CreateCommandAllocator) now returns an allocator proxy,
the fourth command object after the queue and fence (BUILD-231) and the
list (D3D-136): the public chain (9 slots, Reset at 8) is forwarded, a
slot past it up to the end of a 64-slot table is logged and refused with
E_NOTIMPL, and a read past the table faults in its own guard region. The
console allocator's extra methods are not measured and not guessed.

A list takes the title's allocator in CreateCommandList and Reset, so a
proxy is only safe where the list side resolves it. Slot 9 therefore
wraps an allocator only when it answers kLeonidaCommandAllocatorTag (the
Vulkan layer's CommandAllocator, whose from() resolves the proxy for both
calls); a PC runtime allocator is handed out unchanged, logged once,
until a command-list proxy unwraps it at Reset. Allocator proxies are
unwrapped in the residency calls like heap, queue and fence proxies.
Device slot 12 is not touched.

Tests: allocator_proxy_test (WARP, a hardware adapter, the Vulkan device:
forwarding, refused tail, guard region, identity, D3D12's allocator rules,
a list created and Reset on the proxy with GPU copies through the queue
and fence proxies read back), mock cases for allocators with and without
the tag and their failure paths, and device_proxy_test's slot-9
expectations. No game files.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:53 +01:00
af236e196b d3d12_xs: route slot 67 compute pipeline from native code to CreateComputePipelineState (RT-99)
Xbox device slot 67 takes (desc, riid, out) with IID_ID3D12PipelineState and a console-only
descriptor with the root signature at +0x00 and code blob pointer/size at +0x28/+0x30.
Previously it logged and returned E_NOTIMPL.

Route it to CreateComputePipelineState on the PC device (slot 11) like slot 62, mapping the
console descriptor to D3D12_COMPUTE_PIPELINE_STATE_DESC. On the Vulkan device this resolves
through the translator via fssm_program and ShaderLibrary.

- Implement proxy_create_compute_pipeline_from_native_code in d3d12_xs_device.cpp
- Update device_proxy_test to verify slot 67 thunk, compute PSO creation over WARP, and argument checks
- Update d3d12_compute_test to verify slot 67 compute PSO creation on the Vulkan device
- Update documentation in d3d12_command_objects.md and d3d12_vulkan.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:34:10 +05:30
54575594ab Merge pull request #1661 from omardev29 2026-11-22 08:08:35 -05:00
627b0d6ae2 docs: record slot 146 Barrier call-site evidence (D3D-201) 2026-11-22 04:46:50 -08:00
f669f59fd0 docs: slot 67's name and desc, FSPX decoded, and the C++ throw after #965
d3d12_command_objects.md 3.5a: slot 67 is DeserializeComputePipelineStateX
with its full desc (kind 0, 1, 6, 7 pointer/size pairs), and the open
"what FSPX holds" line now points at fspx.md (13 of 29 translate).
d3d12_vulkan.md A.3: the same name, and the throw: before #965 it carried
an image base of 0; with #965 it carries the DLL's base and still reaches
the caller (fsr_dispatch_test, LEONIDA_FSR_NO_STANDIN=1).
2026-11-22 13:42:04 +01:00
9b3f8388b9 Merge pull request #1470 from CLHelper 2026-11-22 06:38:11 -05:00
e948729a25 Merge pull request #1469 from CLHelper 2026-11-22 06:38:11 -05:00
932287398d docs: FSR DLL list slots 54/55/59/85, pipeline slot 11 and the device +0x18 copy switch
Static reading of the FSR DLL's call sites, added to section 3.5a:

- 54 is ClearUnorderedAccessViewFloat and 55 DiscardResource (both +4).
- 59 is one console slot with a bool first argument, used for both ends of a
  GPU event; the two slots the console lacks are among 56-60.
- 85 takes the six CopyTextureRegion arguments (two copy locations), not one
  pointer: buffer-to-texture with a footprint from device slot 38, or
  texture-to-texture.
- Pipeline slot 11 (console-only) gives a per-pipeline scratch value; the
  largest times 0xd0 sizes FFX_XBox_ComputeScratch, and slot 141's fourth
  argument is the bound pipeline's value.
- A byte at device +0x18 selects between the DLL's own 32-byte descriptor
  copy and device slot 24 CopyDescriptorsSimple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:24:15 +00:00
a3460331ff docs: builder command-list slots in console order; +0x490 is Barrier (slot 146)
Re-read the BVH builder's command-list call sites in the console order of section 3.5a:
+0x108 is SetComputeRootSignature, +0x138 SetComputeRoot32BitConstants and +0x168
SetComputeRootUnorderedAccessView (the PC-order readings SetComputeRoot32BitConstant,
SetComputeRootShaderResourceView and SOSetTargets do not fit the argument registers or the
inline writes). RDX at the +0xc8 call is the pipeline. +0x490 (console slot 146) is the
public enhanced Barrier with one global compute-to-compute UAV barrier.

New section 3.3a: slots 37/39/43/45 at other sites, 148 (upload allocator whose pointer is
used as the GPU address), 80 (dispatch with an extra word), 71/73 (label write/wait,
unreachable in the shipping DLL) and the second Barrier site.
2026-11-22 11:08:48 +00:00
62593f47ca Runtime: Xbox-ABI proxies for the command queue and the fence (BUILD-231)
Device slots 8 (CreateCommandQueue), 75 (CreateCommandQueue1), 36
(CreateFence) and 32 (OpenSharedHandle of a fence) now return queue and
fence proxies. They forward the public chain in PC order (19 queue slots,
11 or 12 fence slots), refuse and log a slot past it up to the end of the
proxy's table, and name a read past the table through a guard region and
a vectored handler.

Heap, queue and fence proxies are unwrapped wherever a device or queue
method hands them to the real runtime: queue Signal/Wait, device slots
31/34/35/45/46/50. Arrays are copied without exceptions. QueryInterface
answers only the modelled interfaces, and logs one the real object has
but the proxy does not model. Outputs are cleared on failure as for
slots 14/62/76. --trace-d3d12 records proxy calls in the README grammar.
Every function a thunk hands its words to keeps them in the same
positions, because a title passes only as many as the method takes.

Tests: queue_proxy_test (host WARP, host hardware, Vulkan device;
differential per-process error cases, guard faults, identity, threads,
raw-slot client, child-runner self-test), xs_proxy_mock_test (older
devices, fences without Fence1, OpenSharedHandle branches, allocation
failures; three guard-setup fault modes), and device_proxy_test through
the D3D12XboxCreateDevice shim. No game files.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:08:53 +01:00
3da355d290 FSR: Xbox backend descriptor, console command-list map, XMemGetWorkingSetStatistics and device slot 67
amd_fidelityfx_upscaler_xbox.dll, measured with Ghidra 12.2 (through REA)
and run by fsr_dispatch_test on PC devices (RTX 2000 Ada and WARP) behind
the Xbox-ABI proxy.

Backend descriptor: the provider's create walks the chain for type
0x01000002, {header, device} with the device at +0x10, and ends in
FFX_API_RETURN_ERROR without it (what RT-3 got with 0x0200000x). With it
the DLL creates its backend through the proxy: device slots 14, 15, 18, 19,
27, 38 and 76 and heap slot 9, at the shapes the PC order and the measured
overrides predict; slot 76 takes the seven CreateCommittedResource
arguments. No earlier test here reached slot 76 or heap slot 9.

Two runtime bugs it found:
- XMemGetWorkingSetStatistics takes (kind, stats*): all seven call sites
  pass kind 0x20000001 in ECX and a stack buffer in RDX. The one-argument
  shim wrote to address 0x20000001.
- Device slot 67 is a console-only compute-pipeline call (a code blob in its
  desc), not the PC CreateProtectedResourceSession1 the proxy forwarded it
  to. The proxy now refuses it (E_NOTIMPL).

The context: on the RTX 2000 Ada the create stops at the DLL's HRESULT
check, because the driver refuses its R9G9B9E5_SHAREDEXP texture with
ALLOW_UNORDERED_ACCESS (WARP takes it). The test reports that stop and
retries with one PC stand-in (that texture as R32_UINT). On the context it
records one ffxDispatch into a logging command list that is never executed.

The console command list, from that run and the DLL's recorder (RVA
0x59a0), the same 13 calls on both devices: slots 14, 15, 25 and 26 at
their PC positions, then SetDescriptorHeaps at 32 (PC 28, seen in the run),
SetComputeRootDescriptorTable at 35 (PC 31), ClearUnorderedAccessViewUint
at 53 (PC 49, seen in the run), ExecuteIndirect at 61 (PC 59), and
console-only methods at 85 and 141. 33 and 41 fit SetComputeRootSignature
and SetComputeRootConstantBufferView by shape; the docs mark them inferred.
The logging list forwards only measured slots. The list object also carries
a write cursor and limits (+0x18, +0x28, +0x30) the DLL writes root
arguments and dispatches through while there is room; with the cursor at
the limit every command takes the vtable. These are the fields docs section
3.4 measured in the BVH builder without a meaning.

The dispatch stops at the DLL's compute pipeline: its 29 shaders are DXBC
with an ACCC part (payload tag FSPX) and no DXIL, and the PC runtime
refuses them at slot 62; the dispatch goes on with the null pipeline and
faults, which the test reports as the documented PC limit. Its C++ `throw`
also shows the loader gap: _CxxThrowException finds no image base for a
manually mapped image.

The test's fault report gives the faulting module and RVA, the access, the
C++ throw's ThrowInfo, image base and unwound stack, and the HRESULT the
DLL formatted with the DLL frames that made the failing call.

Docs: d3d12_vulkan.md Appendix A.3 and open question 2,
d3d12_command_objects.md 3.4 and 3.5a, design.md and runtime/README.md.
2026-11-22 04:58:12 +01:00
73997793eb Docs: mark GCL8 resolved in PR #164 2026-11-21 20:37:36 +00:00
9d3743bd47 docs: tighten command-object citations 2026-11-21 20:17:27 +00:00
e4f1d65e93 docs: measured D3D12 command queue/list/fence surface 2026-11-21 20:15:37 +00:00