Repository navigation
d3d12_xs: console device slot 74 registers a page pool and writes its handle (RT-SLOT74-POOL-HANDLE) - #1470
Open
QemmHD wants to merge 1 commit into
Open
d3d12_xs: console device slot 74 registers a page pool and writes its handle (RT-SLOT74-POOL-HANDLE)#1470QemmHD wants to merge 1 commit into
QemmHD wants to merge 1 commit into
Conversation
… handle (RT-SLOT74-POOL-HANDLE) Since #385 the title's call of device slot 74, (pointer, u32, pointer), returns S_OK and writes nothing, so the title keeps whatever its handle word held. VIctory (Marvisak/VIctory, GPL-3, crates/victory-gpu/src/resource.rs, register_page_pool, device method 0x250) reads the method as RegisterPagePool(address, page count, handle out) for a pool of 64 KiB pages, and writes a handle (index + 1) after refusing a null handle pointer, a page count of 0 or an address that is not 64 KiB aligned with E_INVALIDARG. This is written anew from that reading. For a console caller, proxy_slot74 now records {address, page count} in a mutex-guarded registry and writes a non-zero 64-bit handle from a counter (never reused) through the out pointer. It answers E_INVALIDARG and writes nothing for VIctory's three cases and also for an address of 0 and a handle pointer that VirtualQuery does not show as committed, writable memory (a write there would fault, so the console method cannot have succeeded on it either). The first call is logged once. console_page_pool (d3d12_xs_device.h) reads a record back; nothing consumes a handle yet, as queue slot 31 (CopyPageMappingsBatchX, #968) takes the pool's address directly, so the registry stays in d3d12_xs rather than xmem. A host caller still gets the PC slot 74 (ID3D12Device9::ShaderCacheControl). VIctory reads slot 75 (0x258) as UnregisterPagePool(handle); that is left as a TODO, since slot 75 is the PC CreateCommandQueue1 here. Tested: xs_proxy_mock_test check_slot74 (two calls give distinct non-zero handles and their records; a null, read-only, 0-page, 0-address and misaligned call answer E_INVALIDARG, write nothing and take no handle; a host caller still reaches ShaderCacheControl at level 9 and E_NOTIMPL at level 0), plain and with LEONIDA_VK_VALIDATION=1. With main's stand-in put back the test fails at the handle check. Full ctest 309/310 (only d3d12_depth_resolve fails, as on main); the docs/cmake/make_game consistency set passes (578 passed, 5 skipped). RTX 4070 SUPER, Windows 11. No retail run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
Contributor
|
Independent verification (native Windows 11, validation on):
Heads-up for the author: this PR is CONFLICTING/DIRTY vs current main — AI-assisted verification. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: RT-SLOT74-POOL-HANDLE (#14 (comment))
What and why
Console device slot 74 is called with
(pointer, u32, pointer). Since #385,proxy_slot74logs the call and returnsS_OKwithout writing anything, so the title keeps whatever was in its handle variable. VIctory reads the method asRegisterPagePool(address, page count, handle out): it refuses a null out pointer, a zero page count or a base that isn't 64 KiB aligned withE_INVALIDARG, and otherwise records the pool and writes a handle (Marvisak/VIctory, GPL-3,crates/victory-gpu/src/device.rs,register_page_pool). This PR does the same, written anew for this repository:VirtualQuery), since writing there would fault.{address, pages}in a mutex-guarded registry and writes a 64-bit handle from a counter that starts at 1, so a handle is never 0 and never reused.console_page_pool(handle, &addr, &pages)reads a record back for later users.ID3D12Device9::ShaderCacheControl.UnregisterPagePool. Leonida still sends every slot 75 call to the PCCreateCommandQueue1. That's noted as a TODO and indocs/d3d12_vulkan.md.Whether the title reads the handle later hasn't been measured. This just stops it from holding an unset value.
Tested
Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 Build Tools + Ninja, RelWithDebInfo, on main b4b7756.
xs_proxy_mock_test:check_slot74covers two calls giving distinct handles with the right records; the fiveE_INVALIDARGcases (nothing written, no handle used); and host forwarding at levels 9 and 0. It passes both plain and withLEONIDA_VK_VALIDATION=1.d3d12_depth_resolve.git merge-tree: clean against main, d3d12_xs: slot 14 takes the console layout only for committed, writable descriptor memory #1387, d3d12_xs: the first call of a forwarded device slot names its caller (OLD-9990, RT-526) #1390 and d3d12: require a console heap address to be 64 KiB aligned before slot 14 reads it #1328. d3d12_xs: queue slot 31 is CopyPageMappingsBatchX, mapped through xmem (RT-QUEUE31) #968 and [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD) #984 already conflict with main elsewhere, and this adds no new conflict with d3d12_xs: queue slot 31 is CopyPageMappingsBatchX, mapped through xmem (RT-QUEUE31) #968's slot 31 code.E_INVALIDARG. VIctory refuses the same case and reaches the world, which suggests the title passes valid arguments.GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11
AI-assisted: yes
Checklist
mainand merges cleanly.docs/design.md, with how it was confirmed. (n/a: no translator change)AI-assisted (Claude Code, Claude Opus 5.5).
🤖 Generated with Claude Code
https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf