Repository navigation
d3d12_xs: fence slot 12 returns the address of a live completed value, again; the retail boot reaches its frame loop (RT-FENCE12) - #432
Conversation
|
checked: independent native Windows verification of head ee47b0b. Windows 11 x64 build 26100, MSVC 19.44.35220, SDK 10.0.26100, Release, RTX 5070 Ti / NVIDIA 610.74, Vulkan loader 1.4.341. Stock xs_proxy_mock and queue_proxy both passed. I added a local queue_proxy_test case that obtains the slot-12 address once, enqueues a signal behind a wait on a second queue, and releases that wait from the first queue. The pointer stayed at the previous value while blocked and observed the completed signal afterward without a refresh call. The test repeated that handoff on the same pointer with a second distinct 64-bit value, so it also exercised re-arming. This passed 3/3 times on each of native D3D12/WARP, native D3D12/RTX 5070 Ti and Vulkan/RTX 5070 Ti. In a local control with the background wait registration disabled, the completion event fired but the first new value stayed absent at the pointer. The extended test failed on that assertion under WARP. The test fixture and control edits were reverted and both stock tests passed again. Synthetic fixtures only. AI-assisted verification. |
…stack Contains ProjectLeonida#375 ProjectLeonida#377 ProjectLeonida#383 ProjectLeonida#385 ProjectLeonida#391 ProjectLeonida#395 ProjectLeonida#396 ProjectLeonida#403 ProjectLeonida#414 ProjectLeonida#416 ProjectLeonida#427 ProjectLeonida#430 ProjectLeonida#432. # Conflicts: # runtime/shims/d3d12_com.cpp # runtime/shims/d3d12_vulkan_device.cpp # runtime/src/command_list.h
|
Follow-up: the worker-thread AI-assisted. |
…nslate CPU handles (cherry picked from commit 355201c)
…(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 8897855)
…ons (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 c7ca0f2)
…t, slot 56 offsets, full mip chains, rounded-up mip extents, B5G5R5A1, saturating sums (cherry picked from commit 3593908)
…em 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 ae322da) Adapted to main by Mumogg: the lease size is the later form of this series (d61755d, a render target's console tile size, else the PC size), since console_render_target_extra is gone after 3593908.
(cherry picked from commit b4d1ba1)
…g-cl rejects 0x101 for the unfixed enum) Reported by YaBulochka and sovljanskii on #7154; #7110's current head has the same form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit bee4718)
…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 ProjectLeonida#375 from MSVC builds on AMD and NVIDIA, the first bad commit being the one that cleans the descriptions). Together with b4d1ba1, 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 b4d1ba1's check compares with. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
…ole-extended heap A heap that main's console-extended handler created already sits at the address the title named, so proxy_create_descriptor_heap asks the title's XMem hooks for a backing address only when the heap came from a plain PC description (follow-up asked for in review on ProjectLeonida#375). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
…TCH (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 4c04c0f)
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 084c8c6)
…device with mesh shaders The Vulkan layer created signatures for draw, draw-indexed and dispatch only and answered E_NOTIMPL for DISPATCH_MESH, which the PC runtime creates on any mesh-shader tier 1 device. A title that creates such a signature at startup and asserts on the result stopped there. The signature is created when the device has VK_EXT_mesh_shader (MeshShaderTier 1), as a new IndirectKind::dispatch_mesh (the name and value #3777 uses, so the two merge). ExecuteIndirect with it records nothing yet and says so once; #3777 replays it as vkCmdDrawMeshTasksIndirectEXT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit efc3478)
…H has a record size and returns after it Resolving the cherry-pick of efc3478 I dropped main's record-size, stride and span checks (e1ec785), which d3d12_execute_indirect_validation_test depends on and which matter to every D3D12 user (found in review on ubiquitarianism#377). They are back as on main, the record-size chain knows D3D12_DISPATCH_MESH_ARGUMENTS, and the early return for a DISPATCH_MESH signature comes after the checks. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
…ateSampler 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 e229944)
…t 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 c915e1d)
…riptor range Slot 61 passed the destination handle to the PC CreateSampler as given. With the title's descriptor range honoured (__XMemAllocationHooks__), a handle in that range has to be translated to the real heap's, as device slots 17 to 24 do (asked for in review on ProjectLeonida#377). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
… 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 cdeee35) Adapted to main by Mumogg: the queue route inside route_xbox_device_slot calls proxy_create_command_queue_xbox (the 32-byte description of 0cde63d), as the inline route did before this commit moved the routes into a function.
…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
Asked for in review on ProjectLeonida#377. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
(cherry picked from commit e925b63) 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.
…) on allocator proxy (cherry picked from commit e29e989)
…ow in the Xbox-only table Asked for in review on ProjectLeonida#377. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
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 ef9d075 (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
…etDesc 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
…ntation core The retail title presents through command-queue slot 32, past the PC queue's 19 slots, so main refused it with E_NOTIMPL and nothing could be shown. The slot now calls XboxPresentation::PresentX (xbox_present.h) with the title's plane count, planes and parameters. The first call on a device builds a window and the Vulkan layer's presenter for it, once; a device that cannot present answers S_OK and shows nothing, so the title's frame loop runs either way. The mock and COM builds of this file have no presenter and answer S_OK. The wiring follows old PR 2490's (Nolan Cotter, 2be25ce), written again for main's queue proxy, where that commit does not apply. Not carried over: the queue layout detection (the older layout has PresentX at slot 30) and presenting into the title's own window (old PR 8591); the window here is one this layer creates. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
…oken source Device slot 80 (WaitFrameEventX, from #6935) numbered its tokens with a counter of its own, while XboxPresentation's pacer refuses any token above the ones it issued itself. A title that waits through the device and presents through the device's XboxPresentation therefore had every PresentX refused with E_INVALIDARG once its tokens ran ahead of the pacer's. leonida::FrameTokenSource is now the counter both use: a pacer takes an optional shared source (a standalone pacer still owns its own and numbers as before), the device proxy owns one and exposes it through rt::d3d12_xs::device_frame_tokens, and XboxPresentation passes a given source to its pacer. A token that was never issued is still refused. Reported by rafaelpssz in #7496. (cherry picked from commit afb14d5) Adapted to main by Mumogg: main's uncapped pacer path issues its token from the shared source too, the device proxy keeps the PresentX state next to the token source, and the queue's PresentX hands the device's source to its XboxPresentation, which is what makes the title's tokens valid there.
The coverage gate asks for every queue slot to have been called, and skips the overridden ones in its sweep of
the refused tail. Slot 32 is overridden since the PresentX wiring, so nothing called it and the gate failed
("queue slot 32 never called"). The test now calls it where it calls the console ExecuteCommandLists slot: this
build of the proxy has no presenter, so the answer is S_OK.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
…s (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 0aba6c3 (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
…zed and created without it (stand-in) The console allows ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS on a texture; the PC runtime refuses the pair and slot 25 answered UINT64_MAX for it. pc_resource_flags drops the UAV bit from depth-stencil textures (slot 25 through pc_resource_desc, and slot 76). Their UAV views then write no descriptor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 4a86034) Adapted to main by Mumogg: the conflict is with b4d1ba1, which is applied before it here: slot 25 keeps that commit's scoped cleaning, and this one adds the flag rule and its log line.
…nd 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
The retail executable calls fence slot 12, one past ID3D12Fence1, as (value, descriptor, flags) and reads the return as a pointer to the fence's 64-bit completed value: it compares it with ~0 and subtracts the value it waits for. The proxy refused it with E_NOTIMPL, which the title then dereferenced. Each fence now gets a mirror on its first slot 12 call. A wait-thread callback reads the real fence's completed value into it and re-arms SetEventOnCompletion(value + 1), so it follows every completion without another call; slot 12 and the CPU Signal refresh it at once, under a lock. After device removal it holds ~0 and nothing is re-armed. The release of the proxy unregisters the wait before the real fence goes. The descriptor's code pointer is not called. Tests: xs_proxy_mock_test (mock fences now keep a completed value and arm one event) and queue_proxy_test (a real queue signal reaches the mirror). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 5ac4dea)
ee47b0b to
c832dd5
Compare
|
Checked the updated head I also tested concurrent first calls to slot 12 with a local mock-only fixture. Eight threads first queried the same fence at once. Every thread received the same non-null address, the value at that address advanced after an external signal without another slot-12 call, and releasing the proxy returned the mock fence's references to zero. This passed for 32 fences of each type (with/without ID3D12Fence1) in each of 3 runs, 192 fences total. Synthetic tests only, no game files or retail boot. AI-assisted (Codex). |
|
Closing as carried:
Thanks, and thanks to sodove and Dezmonius for the checks. AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in #14 as
RT-FENCE12. Depends on: the stack up to #430 (their commits come first here; this pull request is the last commit).What and why
Fence slot 12 is one past
ID3D12Fence1. The retail title calls it as(value, descriptor, flags)and reads the return as a pointer to the fence's 64-bit completed value.mainrefuses the slot withE_NOTIMPL, and the title dereferences the error code.Commit
5ac4deaa2by TreXito (-x, authorship kept; an ancestor ofmainwhose content is not in the tree): each fence gets a mirror of its completed value that stays current without the title calling anything (a thread-pool wait on the real fence refreshes it; slot 12 and a CPUSignalrefresh it at once), and slot 12 returns the mirror's address. The descriptor's code pointer is not called: its contract is not known, and the commit says so.The conflicts were neighbours (the queue constants of #391 and #403, the allocator fields of #395, the tests' lists); both sides are kept.
Measured: the frame loop
Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off, on
mainece4ba5b3, with #142, #219, #328, #387 and #428 applied on top (they are not in this branch).Correction (I first posted this section with a wrong duration): the runs with this change do not last the 300 s I allowed them. The process ends after about 30 s, exit code 3. I had read the counts and not the exit line. The numbers below are two runs of about 30 s each.
--runCreatePipelineStateokExecuteCommandListsokDrawInstancedXboxPresentation::PresentXokFence::Slot12 unsupportedSo with this the retail title enters its frame loop on
mainhere and presents some 13,000 to 14,000 times, with one draw per present, before the process ends. That is far more presents than seconds: nothing paces the loop on this path.Why it ends, from run 2's startup trace: at 22.4 s a worker thread of the title hits its own
int3(the size check of #427 and #428, on a third description that I have not identified yet); at 28 to 29 s the title's crash reporting runs and the process exits. The frame loop is running the whole time in between. So the next thing on this path is that third description, not the loop.What else is still wrong, so nobody reads more into the table than it says:
primitive topology type not supported: 19: rectangle lists, whichmaindoes not draw (old PR 7448). The integration branch draws three times per present, this path once; that is very likely why.XboxID3D12CommandQueue::Slot31is refused twice.Tests under Wine:
xs_proxy_mock_testpasses with the commit'scheck_fence_completed_value;queue_proxy_testpasses on the Vulkan backend with its fence slot 12 case (the value follows a queue's signal without another call).Not built with MSVC and not run on Windows.
AI-assisted (Claude Code); built and run on the machine above.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt