Repository navigation
d3d12_xs: keep the Win32 PresentX window responsive during rendering - #526
Conversation
…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.
…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)
…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)
… 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
(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)
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
Create and dispatch the Win32 window on its own thread. Shut that thread down after the presenter has released the surface and test window messages and closure independently of the submitting thread.
|
Independent check of the window pump on a second native-Windows machine. Windows 11, RTX 5070, driver 617.14, Responding state of the
The "without" column is from an earlier build of a near-identical stack (#359 and #727 in place of #432 and the others, same machine), not the same tree, so read it as the symptom and not as a paired A/B. What I did not check: dragging, minimising or closing the window, or a run past 55 s. AI-assisted: yes (Claude Code, Sonnet 5.5) |
…n' into fix/windows-present-window-pump
…first-run UI Build on the public frame-loop integration in #321. Carry the texture-view and depth work from #213 and #261, the layout provider from #461, the responsive window from #526, and the rectangle generator from #682. Integrate the Xbox constant-buffer row addressing measured in #513 and the draw-time rectangle selection in #722. Keep all fixtures synthetic. The Windows GPU path resolves title-owned shader objects, retires geometry uploads per submission, materializes texture views on use, maps linear surfaces, and delivers completed GPU label writes. A first-run UI launch selects the tested settings for these paths.
Claimed in the coordination issue as: RT-PRESENTX-WINDOW-PUMP (claim).
Depends on: #414
What and why
The Win32 fallback window created by #414 belongs to the rendering thread. On native Windows the window stopped answering messages during pipeline compilation, and it could still be marked hung while draws and presents continued. Give this HWND a dedicated message thread. Release its Vulkan presenter before waking and joining the window owner on shutdown.
The change to review is ce3e5153f. The preceding PresentX commits are from #414. The title-owned window path is outside this change.
Tested
WM_NULLprobe in 0.08 ms while the game was running. Before the change Windows reported the fallback HWND hung. Captured frames were still black. GPU content is a separate open problem.GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 Pro x64. The hidden-window test needs only a Win32 desktop.
AI-assisted: yes, OpenAI Codex.
Checklist
mainis merged into the stack and the branch merges cleanly.