Repository navigation
d3d12_xs: device slot 133 (CreatePlacedResourceX) makes a buffer on the title's own pages (VK_EXT_external_memory_host) - #7218
tibzejoker wants to merge 10 commits into
Conversation
…e PC vtable refuse with E_NOTIMPL The retail title calls device slot 133, past the 128-entry table; the call read an empty entry and jumped to 0. Every slot beyond the PC device's vtable now reaches the generic thunk. Mock test covers slot 133. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ory (VK_EXT_external_memory_host) The retail executable opens the 64 KiB graphics region it has just committed with XMemVirtualAlloc through device slot 48 right after its first queue and fence; the layer answered E_NOTIMPL and the title asserted. The call now answers as the host runtime does on an RTX 4090 and WARP (six cases measured in d3d12_existing_heap_test): the base of a VirtualAlloc allocation committed read-write over its whole size opens a heap of that size, 64 KiB aligned, CUSTOM / WRITE_BACK / L0, SHARED | SHARED_CROSS_ADAPTER | ALLOW_SHADER_ATOMICS; an inner address, a partial or reserve-only commit and a read-only range are E_INVALIDARG. The backing is the range itself, imported with VK_EXT_external_memory_host, which the device and the test device enable when present. CheckFeatureSupport(EXISTING_HEAPS) follows the extension. Placed resources in such a heap are refused (E_NOTIMPL, logged) until the placed path addresses memory outside the arena. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… an uncached one is refused Measured on the RTX 4090 and WARP: PAGE_READWRITE | PAGE_WRITECOMBINE is accepted with CPUPageProperty WRITE_COMBINE, PAGE_READWRITE | PAGE_NOCACHE is E_INVALIDARG. Two new cases in d3d12_existing_heap_test; 8 of 8 match both host devices. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he title's own pages Xbox device slot 133 is (va, desc, state, clear, riid, out): the title places a buffer at the VA of a physical-page range it has just mapped (docs/retail_boot_chain.md 3.4, ItsNotRexed#6915). The proxy now hands it to a handler the Vulkan layer registers (set_placed_at_va_handler), which imports [va, va + width) with VK_EXT_external_memory_host and binds a VkBuffer to it: the CPU's writes there are the GPU's reads with no copy, and the resource's console VA is the title's VA, so views and immediate writes the title names by that VA resolve to it through the buffer VA index. The Xbox flag bits above the PC ones are dropped and the layout made ROW_MAJOR, as slot 76 does; textures are E_NOTIMPL, a misaligned VA E_INVALIDARG, and with no handler (a PC device) the slot refuses with E_NOTIMPL as ItsNotRexed#6953's table does. Not decided here: a shader that adds heap_base to the title's VA (its own V#s) does not reach these pages; that needs the single address space of docs/d3d12_vulkan.md 3.3. d3d12_existing_heap_test: on a VirtualAlloc range and on a view of a pagefile-backed section (the form xmem's physical pages take), the buffer's GPU VA is the address and a GPU copy to a READBACK buffer reads a pattern the CPU wrote after creation; Vulkan validation clean on an RTX 4090. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent synthetic test of The stock head does not compile with this SDK and clang-cl: With that one-line change, AI-assisted (Codex). |
|
Retail-path integration test of The handler is registered in AI-assisted (Codex). |
|
Independent native Windows / RTX 3060 check at I reproduced the clang-cl build error at With that build, AI-assisted testing. |
…ler registered by every Vulkan device The PC flag mask was a D3D12_RESOURCE_FLAGS constant past the SDK's last enumerator, which clang-cl with SDK 10.0.26100 refuses as a constant expression; it is an integer now, cast after the AND. The slot-133 handler was registered in create_vulkan_device only, so the standalone device gta6rt --run creates never served the slot; the Device constructor registers it now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Retail follow-up on There is a missing registration on the retail path. The patch registers A common registration point for both device factories, or the one-line registration in the standalone factory, closes the gap. The retail test was offline with the local 1.0.2.1 package. Outcomes only. AI-assisted (Codex). |
# Conflicts: # runtime/shims/d3d12_xs_device.cpp
|
Thanks all three.
Retested at |
|
Review note (stray submodule bump). The diff at |
… found in review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@ruvenesh thanks, right: it came in with a local merge. |
|
Tested on the retail executable (own 1.0.2.1 copy, Windows 11 26200, RX 9070 XT, AMD Windows driver, Concern: the handler is never registered on the path With that one line added before rt::d3d12_xs::set_placed_at_va_handler(&create_buffer_at_host_address);the title's call goes through: That's a 174 MiB buffer imported from the title's three mapped windows (#6919's maps), on AMD with no validation complaints in this build. The title then creates a descriptor heap (slot 14) and reads its CPU start (heap slot 9), and stops on a new assert past this PR. I'm looking at that one next. One run each way, counts and API names only. AI-assisted (Claude Code). |
|
@sneylol thanks, that's the first AMD retail run. The registration gap you hit was in |
|
Tested the #7218 slot-133 implementation with both device factories wired up, on CachyOS, Wine 11.22, Mesa 26.3.1. The same runtime and inputs give different results on RADV and lavapipe.
The last case is a synthetic guest using the public runtime entry point. I also ran my local copy offline with each backend. At the first 174 MiB placement RADV returns 0x8007000e. Lavapipe succeeds at that same call and the game creates its first descriptor heap. The full-size test checks placement and the reported address. Byte-for-byte GPU readback was tested on the 256 KiB cases indicated above. This narrows the remaining hardware issue to the section-backed case. The independent sparse binding / copy control on this Radeon may be useful for the backing-memory work. AI-assisted testing. |
|
Retested on Windows / RTX 3060, NVIDIA 621.14, clang-cl/xwin SDK 10.0.26100. Updated head 2b584ec builds unmodified, and xs_proxy_mock passes. The stock d3d12_existing_heap test exits with 0xC0000008 on both 2b584ec and main 8575d36, with validation on and off. On 2b584ec, omitting only the OpenExistingHeapFromFileMapping(0x1234) assertion in the local test let the rest pass with validation enabled. Both slot-133 fixtures read back all 262,144 bytes, and all eight host comparisons matched both native NVIDIA D3D12 and WARP. AI-assisted testing. |
… not import the title's pages RADV under Wine refuses to import a view of a pagefile-backed section (E_OUTOFMEMORY on an RX 9070 XT, found in review), which is the form xmem's physical pages take, so the retail boot stopped at the first 174 MiB placement. An import failure other than a misaligned VA now gives an ordinary DEFAULT buffer of the same description, as ItsNotRexed#6915's stand-in did, logged once: the boot goes on, and the title's writes at that VA don't reach it on such a driver. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Stalkerino thanks, that's the case I couldn't see on NVIDIA. RADV refusing the section view fits amdgpu userptr, which won't pin shared, file-backed mappings, while anonymous memory imports. @umnitus thanks for confirming the Retested at |
|
Independent native Windows 11 / MSVC 19.44.35230.0 / AMD Radeon RX 6700 XT (
AI-assisted (Gemini, Antigravity). |
|
At current head |
…commit re-added it, found in review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@editrice thanks, right again: my fallback commit staged the working tree's submodule with |
|
Independent Windows / RTX 5090 check of Synthetic result (clang-cl 21.1.8 + xwin SDK 10.0.26100, static CRT, Windows 26300, NVIDIA driver 32.0.16.2124):
The final WC failure reproduced 3/3 repeat processes. The independent pattern oracle reports CPU bad = 0; GPU bad was 427,326 / 330,324 / 342,156 bytes of 2,097,152 in those runs. A Reproducer for reuse: one test-only commit, based directly on this PR's Retail integration result: main
No raw traces, game data, addresses or title offsets attached. Retail socket creation, DNS and transmission debugger-guarded. AI-assisted (Codex). |
|
Code read of
Not run: code read only, no tests run. AI-assisted review. |
|
Follow-up to exclude the host-backing lifetime issue noted in review: I added an isolated first-import mode in Zunraz@d5c129911 (on top of the test-only commit above). It creates a fresh Vulkan device, goes directly to the single 2 MiB adjacent-view fixture, and retains all its views and the section handle until process exit, after Vulkan teardown. No preceding OpenExistingHeap/import fixtures run. The CPU-store MemoryBarrier remains present. Fresh-process comparison, same environment as above:
Run the patched The PR's latest |
Claimed in the coordination issue: #6750 (comment) (design note: #6750 (comment))
Depends on: #6953 (the proxy table must reach slot 133). Relates to #6995 (xmem physical pages) and #6915 (
docs/retail_boot_chain.md, §3.4).What and why
Xbox device slot 133 is the console's
CreatePlacedResourceX:(va, desc, state, clear, riid, out). The retail title places a buffer at the VA of a physical-page range it has just mapped. Until now the slot either jumped through a missing entry or, in #6915's local stand-in, got an unrelated committed buffer, so what the title writes atvanever reached the GPU.d3d12_xs: slot 133 masks the Xbox flag bits down to the PC ones, makes a buffer's layoutROW_MAJOR(as slot 76 does), and hands the call to a handler that the device behind the proxy registers (set_placed_at_va_handler). With no handler (a PC device), it answersE_NOTIMPLwhatever the arguments, as d3d12_xs: the device proxy table covers slot 133, so slots past the PC vtable refuse instead of jumping to 0 #6953's table does. The handler keepsd3d12_xs_device.cpplinkable without the Vulkan layer (the mock tests).create_buffer_at_host_addressimports[va, va + width)withVK_EXT_external_memory_hostand binds aVkBufferto it. The CPU's writes there are the GPU's reads, with no copy. The resource's console VA is the title's own VA, so views and immediate writes the title names by that VA resolve to it through the buffer VA index. Textures areE_NOTIMPLand a VA off the import alignment isE_INVALIDARG.vk_test_device.h) enablesVK_EXT_external_memory_hostwhen present. The same import backsID3D12Device3::OpenExistingHeapFromAddress, which now answers as the host runtime does (8 cases, below) instead ofE_NOTIMPL.CheckFeatureSupport(EXISTING_HEAPS)follows the extension. Placed resources in such a heap are refused and logged for now.Not decided here: a shader computes
heap_base + console_va, so the title's own V#s that point into these pages don't reach them. That needs the single address space ofdocs/d3d12_vulkan.md§3.3 (options in the design note above). This PR makes the data path and the VA bookkeeping right without picking one.Tested
RTX 4090, driver 617.42, Windows 11 26200, MSVC 2022 RelWithDebInfo:
d3d12_existing_heap_testwithLEONIDA_VK_VALIDATION=1, no validation errors:VirtualAllocrange and on a view of a pagefile-backed section (the form xmem: serve XMemAllocatePhysicalPages, XMemFreePhysicalPages and XMemMapPhysicalPages[Scatter] (RT-5 next stop) #6995 maps physical pages in). The buffer's GPU VA is the address, and a GPU copy to a READBACK buffer reads back a pattern the CPU wrote after creation, byte for byte. A texture givesE_NOTIMPL, a misaligned VAE_INVALIDARG.OpenExistingHeapFromAddress: 8 of 8 cases match the host runtime on the RTX 4090 and on WARP. A whole read-write allocation opens a heap of its size, 64 KiB aligned,CUSTOM/L0, flags0x421,WRITE_BACK(WRITE_COMBINEfor aPAGE_WRITECOMBINErange). An inner address, a partial or reserve-only commit, read-only andPAGE_NOCACHEareE_INVALIDARG.xs_proxy_mock_test: PASS, including d3d12_xs: the device proxy table covers slot 133, so slots past the PC vtable refuse instead of jumping to 0 #6953's slot-133 refusal with no handler.ctest: the only failures ared3d12_indirect_dispatch_count,xbox_presentandd3d12_indirect_rt, which fail the same way on the base without this change (d3d12_xs: the device proxy table covers slot 133, so slots past the PC vtable refuse instead of jumping to 0 #6953 onmain).AI-assisted: yes (Claude Code).
🤖 Generated with Claude Code