Repository navigation
d3d12_xs: derive pipeline states for device slot 55 - #7759
LooperSalty wants to merge 8 commits into
Conversation
… proxy, not through slot 78 ItsNotRexed#6935 routes the Xbox device proxy's slot 78 to the title's SetFrameIntervalX, by design: the proxy is the title's device, answers ID3D12Device11 with itself, and shadows PC slots the way 62 and 76 already are. The test still called the PC ID3D12Device10::CreateReservedResource2 through the proxy, so the call reached SetFrameIntervalX and `tiles == 1` failed (@fever308's finding on ItsNotRexed#7049). The PC method is now checked on the Vulkan device behind the proxy, the same call and the same expectations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slot 55 is the console's CreateDerivedPipelineState(pBasePSO, n, pRecords, riid, ppv): n = 1..4 records of 0x14c bytes (a u32 tag, payload at +4) that patch the base PSO's state before a new PSO is created. - Slot 86 keeps a deep copy of the stream it creates on the returned PSO (ID3D12Object private data, released with the PSO): shader bytecode, stream-output and input-layout arrays and strings, cached blobs, and AddRef'd root signatures. - Slot 55 patches a copy of the base stream and creates the PSO through the slot 86 path, so a derived PSO can itself be a base. - Tags: 0 = DEPTH_STENCIL (or the DEPTH_STENCIL1 prefix), 1 = RASTERIZER, 2 = BLEND, 3 = sample mask (TomBox layout; the 1.0.2.1 title does not write it), 5 = StencilReadMask and StencilWriteMask bytes overlaid on the base's DEPTH_STENCIL, applied in record order. Other tags are refused. - A base not created through slots 86/55, a base without the matching subobject, malformed records, and n outside 1..4 are refused with E_FAIL or E_INVALIDARG and a null output, each logged once. - Slot 55 shadows PC CreateReservedResource1 (PC slot 55) on the proxy, as slot 78 shadows PC CreateReservedResource2 in ItsNotRexed#7125; the vulkan device test calls the PC method on the real device behind the proxy. Tests: pso_stream_test (synthetic streams: console subobject offsets, deep copy, patching, tag 5 overlay and record order, refusals) and device_proxy_test over WARP (refusals, graphics base via slot 86, n = 3 and n = 4 derivations, a derivation from a derived PSO). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwHrL5Lxc1rum25b6tnpo8
gut0to
left a comment
There was a problem hiding this comment.
Reviewed the new stream ownership and derivation path, slot dispatch, resource-description conversion, and added test coverage. The capture walker bounds each payload before copying, refuses unmodelled subobjects, retains root signatures, and copies pointer-backed stream data; derive applies only modeled tags and validates record count/state before creating the result. The slot 108 conversion zeroes the newer-only field and masks console-only layout/flag bits before forwarding. I found no actionable issue in the diff. I did not independently build this PR in this pass.
|
Tested What was run
Code & documentation findings
AI-assisted. |
|
tested: #7759 (d80c408, the slot-55 commit cherry-picked) on the retail 1.0.2.1 executable | os: Windows 11, MSVC 14.44 | gpu: RTX 4090, NVIDIA 617.42,
The conflicts against the stack were trivial: includes, the slot name table and AI-assisted (Claude Code). |
|
Measurement on the retail executable, as the author: the 1.0.2.1 title does not call slot 55 through the frame loop, so this PR is not exercised by the boot yet. Windows 11 26300, RTX 4070 SUPER (driver 610.88), So the call site at |
|
base: #7759 at Comparison with SweatierKey's new slot-55 description:
Two build-integration findings at this head:
I left the already reported stream-output semantic-name ownership and inherited cached-PSO findings with the existing reviewer. Their affected production code is unchanged at this head. |
|
checked: A38, #7759 builds and its pso_stream CTest passes. base: exact PR head d80c408, no local changes. on: CachyOS x86_64, clang-cl/xwin with Windows SDK 10.0.26100, Release, Wine 11.22. Built gta6rt and pso_stream_test; CTest 1/1 passed. This fixture verifies stream decoding, deep copy and override handling without a GPU. The reviewed runtime stream files and fixture passed check_no_game_data.py. No retail test of this PR head in isolation. AI-assisted. A38 claim: #7154 (comment) |
|
checked: #7759 | with: merge of PR head onto main, then
AI-assisted. |
|
Measured on the retail 1.0.2.1 executable, since your local stack stopped before the first slot-55 call. I applied this PR on a local boot integration (Windows 11, RTX 4070 Ti, driver 621.24). Only the slot-55 commit, with conflicts resolved against that branch. Without the PR, the title's first slot-55 call (the return address after With the PR, there is no crash and boot runs the full 8-minute window. Slot 55 is reached and served, and the title goes on. One case is refused, and it looks like a real gap. Six calls in one run, all the same shape:
So Counts come from a local diagnostic line in AI-assisted (Claude Code), posted with the user's agreement. Measured on the user's own copy. No game data here, only counts and call shapes. |
|
Independent retail result for
Both tests used the same local shader indexes. Counts and API names only. AI-assisted. |
… PC CreateReservedResource1 Measured on retail 1.0.2.1: the title calls device slot 55 with five arguments after the device (base pipeline, record count, a stack array of 0x14c-byte records, riid, output) and uses the output after checking the HRESULT. By slot number the call reached PC CreateReservedResource1, which has one more argument, so its output pointer was a stack word the title never wrote: the PC method stored null through that word on each of about 41,500 calls a boot. Three boots ended in an access violation at that store (read of a non-canonical address, write to 0x4, write into a read-only host page), and the store is a wild 8-byte zero write in every other call. The slot now answers the base pipeline with one more reference; the records (tags per upstream ItsNotRexed#7759) are counted and logged but not applied, which is exact for the LEONIDA_STUB_PIPELINES stand-ins. Also repairs the dev merge of xs_proxy_mock_test.cpp: the recorded resolution had kept only this branch's side, dropping dev's depth-format check and its slot 127 clear-value expectation. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
checked: #7759d80c408 | with: merged on top of tibzejoker:rt5-integration@4037bd7 (+ #88158e8c5df), Slot 55 counts, 4 runs (2 x 300 s, 1 x 300 s, 1 x 600 s),
What the title does instead:
So on this base the title reaches PSO creation through slot 86 only; slot 55 is not on the path before at least 9k PSOs. This does not reproduce the 32,256 slot-55 failures @SweatierKey measured in #8869, so that stack must get further than this one; their base (and whether the calls come after PresentX starts) would settle where slot 55 sits in the boot order. Counts only, no game data. agent: yes |
|
I tested this on a local boot build of the retail 1.0.2.1 title.
This means slot 55 needs a kept stream on every PSO creation path the title uses, not only slot 86. Whoever lands slot 57 should keep one there too. AI-assisted (Claude Code). Windows 11, RTX 5070, driver 621.24. |
|
@LooperSalty Quick clarification on the 32,256 count: that figure was quoted from the |
|
Ported onto a local integration of the retail boot chain and run against my own 1.0.2.1 copy (RTX 4090). The record reader works as written: tags 0 depth-stencil, 1 rasterizer, 2 blend, 3 sample mask and 5 stencil masks, applied to a kept copy of the base's stream. One gap for the retail title: it calls slot 55 about 41,500 times per boot, and its bases are slot 57 pipelines ( Our fix is on Tests: AI-assisted (Claude Code). |
|
Confirmed the missing ABI route in a real native Windows/RTX 5070 Ti run on the earlier rt5-integration 2bd3841 stack: the host faults in Device::CreateReservedResource1, reached through proxy_slot<55> from the title. The PC method interprets console derived-PSO arguments as resource arguments and dereferences an invalid output pointer. This is not evidence of Vulkan device loss: a breakpoint on the runtime device-loss marker was not reached. I have fetched the new rt5-integration 2229c0a containing this PR and am integrating the actual derived-PSO route; no guest assertion skip. |
…vice slot 55 Squashed from ItsNotRexed#7759 by LooperSalty, head d80c408 (security scan PASS). Contains ItsNotRexed#7201 and ItsNotRexed#7125 (both already here). Conflicts: slot names, routing, device_slot_overridden and the header add slot 55 to the union; docs, the CreateReservedResource checks in d3d12_vulkan_device_test and device_proxy_test take this PR's version; the mock test keeps the slot 133/41/61 checks.
…t expectations) ItsNotRexed#7759 carries ItsNotRexed#7201's slot 86/101/108 handlers; its squash added them a second time next to ItsNotRexed#7201's copy (the 101/108 bodies are identical, and ItsNotRexed#7759's slot 86 keeps the PSO stream for slot 55), so ItsNotRexed#7201's copy is removed. xs_proxy_mock_test: the check_xbox_slots summary line merged for ItsNotRexed#7163 had its \n written as a line break; ItsNotRexed#7235's slot-127 hook check now expects no PC slot 25 call for a listed render target (the console-size port from ItsNotRexed#7240 sizes it, same 33,423,360 B); ItsNotRexed#7821's check_view_heap_cap releases the heaps it makes, since its CreateDescriptorHeap mock case is now ItsNotRexed#7021's, which makes a heap proxy holding the device. d3d12_vulkan_device_test: the meta-command checks run on the device behind the Xbox proxy, as ItsNotRexed#7125 does for CreateReservedResource2: proxy slot 61 is the title's CreateSamplerX (ItsNotRexed#7115).
…ots 86, 101 and 108 Squashed from ItsNotRexed#8517 by Hiiva, head 07b32da (security scan PASS). Applied as the PR's own diff (gh pr diff): its branch sits on a newer upstream main. The tree already has one handler per slot (ItsNotRexed#7201, with ItsNotRexed#7759's stream-keeping slot 86), and the apply added this PR's copies beside them; the copies are dropped and the single handlers go through the queried interfaces instead: create_pso_from_stream (slots 86 and 55) through ID3D12Device2, slot 101 through ID3D12Device5, slot 108 through ID3D12Device8. Its check_distinct_device_interfaces test is added to the mock test's list.
…ompiles are host stalls Slot 57 now creates every pipeline as one pipeline state stream through the proxy's create_pso_from_stream (ItsNotRexed#7759), which keeps the stream on the PSO, so slot 55 can derive from slot-57 pipelines; the stub request goes the same way. A device without ID3D12Device2 refuses slot 57 as it refuses slot 86. The Vulkan device's vkCreateGraphicsPipelines now runs inside the same rt::host_stall::Scope as the compute compile (ItsNotRexed#7858), so a guest Sleep sits out the slot-57 compile burst instead of tripping the title's hang check. xs_native_pso_test: the mock answers only PC slot 47, its root signature and pipelines are COM objects with private data, and a new case derives through slot 55 from a slot-57 pipeline.
|
Integration follow-up with #8890 and all demanded native graphics programs: the PC-slot-55 access violation is fixed, but the title now hits the documented refusal, base PSO has no kept stream. Every sampled slot-55 derivation is refused that way on this run. The proxy currently retains creation state at slots 86/55, not the D3D12_GRAPHICS_PIPELINE_STATE_DESC produced by slot 57. I am adding an exact owning stream representation for that already-converted native graphics descriptor, reusing PsoStreamRecord/derive_stream rather than guessing new fixed-function fields. Synthetic coverage and the retail comparison will be reported separately. |
|
Exact native-state retention follow-up: the local slot-57 path now captures the D3D12_GRAPHICS_PIPELINE_STATE_DESC it actually submitted into PsoStreamRecord, before its temporary input-layout strings expire. It uses the same stream decoder/derive_stream path, with no new guessed state fields. The authored regression mutates caller shader/layout/SO/cache buffers, derives four state records, recaptures and releases the base; contents and state changes are checked. Both it and the existing stream oracle pass natively with MSVC. On the retail comparison, 41,545 slot-55 derivations now return success (previously refused for missing base state); the later queue refusal/title breakpoint and black readback remain. This fixes that ABI/base-state boundary, not the final rendered image. |
|
Two things from reading this code as it runs in the maintainers' integration 1. Every pipeline keeps a private copy of all its stage bytecode.
With the pipeline counts reported in the boot log (tens of thousands created and kept for the whole boot), the records hold one copy of every stage container per pipeline. Whether that is megabytes or gigabytes depends on the container sizes, which I cannot measure; I have asked for the number in #8851. A way out that keeps the record's contract: hold the stage bytes as 2. Allocation failures on the same path leave the thunks as exceptions, and one leaves a lock held.
The worst one: #9091 (slot 67) and #9417 (the root-signature exports) are the same class on GitHub Not checked: any run, any measurement, and whether a later commit on the integration branch already changes this ( AI-assisted (Claude Code). |
Claimed in: #7496 (comment) (status in #7694: #7694 (comment))
Depends on: #7201 (slot 86), #7125 (test policy for PC methods behind the proxy). Both are merged into this branch so it builds and tests on its own; the slot-55 change is the last commit.
What and why
Device slot 55 is the console's
CreateDerivedPipelineState(pBasePSO, n, pRecords, riid, ppv). The retail 1.0.2.1 title calls it when a requested state differs from a PSO it already has.nis 1 to 4 records of 0x14c bytes, each a u32 tag and a payload at +4. Nothing served slot 55 before this PR.D3D12_DEPTH_STENCIL_DESC(0x34 bytes, or the prefix ofDEPTH_STENCIL1), 1 =D3D12_RASTERIZER_DESC(0x2c), 2 =D3D12_BLEND_DESC(0x148), 3 = sample mask (TomBox; the 1.0.2.1 title does not write it), 5 = theStencilReadMaskandStencilWriteMaskbytes, overlaid on the base's depth-stencil, applied in record order. Tags 0, 1, 2 and 5 were read from the title's record writes in the retail build (static disassembly). The title can send up to four records (rasterizer, depth-stencil, tag 5, blend on independent paths).noutside 1..4.CreateReservedResource1(PC slot 55) on the proxy, as slot 78 shadows PCCreateReservedResource2in d3d12_vulkan_device: check PC CreateReservedResource2 behind the Xbox proxy, not through slot 78 #7125. The vulkan device test calls the PC method on the real device behind the proxy.Tested
Windows 11 26300, RTX 4070 SUPER (driver 610.88), MSVC RelWithDebInfo.
pso_stream_test(new, no device): console subobject offsets, deep copy, patching of each tag, tag 5 overlay and record order, refusals. Written first; it failed on the stub, and it passes now.device_proxy_testover WARP: refusals (tag 6, missing subobject, base not kept, null records and riid,n= 0 andn= 5), a graphics base created through slot 86, derivations withn= 3 andn= 4, tag 2 alone, and a derivation from a derived PSO. All pass.d3d12_vulkan_device: passes.d3d12_indirect_dispatch_countandd3d12_indirect_rt, both already failing on main.Credit
The record size, payload offset and tag 3 layout come from TomBox's
create_derived_pso_x(omonkeyz/xbox-emulator, GPL-3.0, commitf89e4106fe,crates/compat/d3d12_xs/src/device_wrap.rs). The tag 0, 1, 2 and 5 layouts were checked against the title's writes. The code here is new.Limits
VIEW_INSTANCING) is not kept, so that PSO is refused as a base (logged once).Slot numbers, tags and counts only, no game data. AI-assisted (Claude Code).
cc @ItsNotRexed