Repository navigation
Conversation
…nslate CPU handles
…descriptor heaps and translate CPU handles) Conflicts with main resolved by keeping both sides: device_slot_overridden keeps main's Xbox slot routes and adds ItsNotRexed#7021's slots 17-24; the mock test keeps the command_list kind and check_xbox_slots next to ItsNotRexed#7021's heap kind and check_descriptor_heap_hooks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ABh377Xfov1ZDULWTYvTm
On the console a descriptor heap is plain memory. A title can create views with Create*View into a CPU-only heap and later assemble its shader-visible tables with plain CPU copies from that heap's memory. With ItsNotRexed#7021 the heap's memory is the title's own backing, but device slots 17-24 translate the destination handle to the layer's heap, so only the layer's copy is written; the title's backing stays zero and the tables it assembles from it hold null descriptors. After each CreateConstantBufferView, CreateShaderResourceView, CreateUnorderedAccessView, CreateRenderTargetView, CreateDepthStencilView, CreateSampler, CopyDescriptors and CopyDescriptorsSimple whose destination lies in a title-backed heap, the bytes the layer wrote are copied back over the title's backing at the same offset: count * stride bytes, clamped to the heap. The stride is the layer's increment for the heap type, which already sized the backing (slot 14) and which the title steps its handles by (slot 15 forwards it), so the two sides cannot disagree. The copy is enabled per heap only when the layer's CPU handles for it are readable committed memory (the Vulkan layer's and WARP's are); an opaque driver handle disables it with one log line. Tests: xs_proxy_mock_test checks every slot and both copies into a CPU-only title-backed heap, the clamp at the heap's end and a null size array; device_proxy_test checks a CBV into a CPU-only title-backed heap on WARP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ABh377Xfov1ZDULWTYvTm
|
Tested
The AI-assisted (Claude Code). No game files. |
|
@AAyberkU, a static read of the retail executable that backs this PR, plus one more slot your "note for later" already points at.
Linux/Wine data on the same draw is in #8683 (7114755514) and #9522 (7114817347). I'm moving my Linux integration onto #7021 + #9137 + #9276 + this PR now and will report the result here. AI-assisted (Claude Code). |
|
A complement from the #9137 side. The mirror covers what the layer writes. The other direction is not wired anywhere yet: what the title writes or copies itself into a title-backed heap. #9137 has a hook for it, Our measurements on the retail boot (RTX 5070 Ti Laptop, NVIDIA 621.24, our boot stack, which includes #7021 and #9137; counts only):
The scan window is now in #9137 ( Proposal for the source, which needs #7021's ranges, so it belongs on this branch rather than in #9137:
One risk: the pull must not run without the mirror. A slot the layer wrote via I can push that as a commit on your branch, with a mock check in AI-assisted (Claude Code, Claude Opus 5.5). |
|
Linux/Wine test of this PR at head
One side note, not caused by this PR as far as I can tell: under Wine those WARP tests exit with 1, not the AI-assisted (Claude Code). |
|
Thanks, all three of you. VibeClauding, the straddle case: it is in Etr0p, the other direction: agreed. Our local stack already has exactly that source, and that is how I measured coverage:
Since #9137 isn't in main, I'd keep this PR mirror-only so it stands on #7021 alone. The source would go in a small follow-up on top of #7021 + #9137 + this PR, registered only for heaps where the mirror is on (the KkelebekK, slot 70: yes. Our local build also calls the mirror from the console raw-SRV slot 70 path. Whichever PR gives slot 70 a real view (#8304 / #7066 / Etr0p's item) should call AI-assisted (Claude Code). |
|
Tested 4747819 merged onto main 5d74c27 on Windows 11 Pro 24H2 (build 26100), AMD Radeon RX 9070 (RDNA4 / GFX1201), AMD Software 26.10.1 (Vulkan 1.4.359), MSVC 14.44 (VS 2022 Community 17.14.40), RelWithDebInfo: pass. Confirming the WARP and Windows host runtime checks noted by @KkelebekK (which could not run under Wine):
AI-assisted. Synthetic tests only, no game files. |
|
Independent native Windows check of the unmodified #9586 head I confirmed the distinction between the two directions in an offline Windows/RTX 4090 boot comparison with the original game shaders. Adding this PR's write-back and mirroring the existing console slot-70 buffer-view path left slots 0–2 empty in all 63 sampled shader-visible tables. Registering a local snapshot-based source through #9137 then populated slot 0 in all 63, with the scan still requesting one descriptor for each of these tables. Both captures with the one-slot scan were black. This corroborates the need for a second, separate change to pull CPU stores into shader-visible storage. The local callback is an integration test of the proposed follow-up. AI-assisted (Codex). |
|
AMD Windows check of
No game files. |
Connect the descriptor-source hook from ProjectLeonida#9137 to the heap backing tracked by ProjectLeonida#7021 and written by ProjectLeonida#9586. Cache observed source bytes so repeated submissions keep their translated V# addresses. The GPU fixture now assigns separate title backing, checks its shader reads, and verifies unchanged source writes retain the translated address. All 15 focused tests passed on Windows 11 and RTX 3060 Ti. AI-assisted with Codex.
Claimed in the coordination issue: #9401 (comment)
Depends on: #7021. This branch includes a merge of its head, so review only the last commit.
What and why
On the console a descriptor heap is plain memory. The title creates views with
Create*Viewinto a CPU-only heap backed by its own__XMemAllocationHooks__allocator (#7021). It then builds its shader-visible descriptor tables with plain CPU copies from that backing.With #7021, device slots 17-24 translate the destination handle to the layer's heap, so only the layer's copy gets written. The title's backing at that slot stays zero, the tables it builds hold zeros, and shaders read null V#s.
In
runtime/shims/d3d12_xs_device.cpp, slots 17-24 now copy what they write back into the title's backing. That coversCreateConstantBufferView,CreateShaderResourceView,CreateUnorderedAccessView,CreateRenderTargetView,CreateDepthStencilView,CreateSampler,CopyDescriptors(a null size array means one descriptor per range) andCopyDescriptorsSimple.real_start + offsetback to the title address:count * stridebytes, clamped to the heap.VirtualQuerychecks that the layer's CPU handles for it are readable committed memory. They are with the Vulkan layer and with WARP. If a driver hands out opaque CPU handles, the copy is turned off for that heap and one line is logged.Measured result
Retail 1.0.2.1, RTX 5060 Ti, driver 621.01, with #9137 and #9276 also applied. The details are on #7021 and #8851.
Tested
Windows 11, MSVC 2022 (
RelWithDebInfo, Ninja), Vulkan SDK 1.4.363.0.xs_proxy_mockwith its 5 fault/env variants, plusdevice_proxyanddevice_proxy_trace(WARP): 8/8 pass.check_descriptor_mirrorinxs_proxy_mock_test:CopyDescriptorswith a null size array;device_proxy_test: a CBV into a CPU-only title-backed heap reaches the title's backing.python -I scripts/check_no_game_data.pyon the changed files: exit 0.mirror_title_descriptors(self, destination, 1)there too.AI-assisted: yes. Built and measured with Claude Code.
Checklist
docs/design.md(n/a: runtime change).🤖 Generated with Claude Code
https://claude.ai/code/session_016ABh377Xfov1ZDULWTYvTm