Repository navigation
d3d12_xs: console-ABI command lists, upload arena, PC-list fixture path - #2490
NolanCotter wants to merge 7 commits into
Conversation
|
Tested hello_pixels at 9213603 on RTX 3060 12 GB, NVIDIA 621.14, Vulkan 1.4.357, Windows 11 26H2: pass. Ran python -B -I tools/hello_pixels.py --work --harness <same-commit-vk_harness.exe> --size 512 --run --check. Exit 0. The GPU framebuffer had 262,144/262,144 covered pixels, all seven reference probes passed, and the raw, PPM and PNG outputs were written. The harness was built with llvm-mingw Clang 23.1.6 from the tested commit. AI-assisted verification. |
|
Tested Windows MSVC Build & Runtime Tests
Real Hardware Verification (
|
|
Fixed in Thanks @umnitus (RTX 3060/Windows) and @adriaespii (RX 9070/MSVC + llvmpipe) for the hardware runs — the MSVC clean build and 110/110 CTest covers the uncompiled-locally caveat. |
|
Code review of the loader and inventory parts (AI-assisted), checked at defa3f1, with synthetic PE images and the repo's 1. The host-binding fix is bypassed when the import's DLL name has no
2. 3. The inventory ignores delay-load imports (proved). It reads only data directory 1. The loader binds directory 13 eagerly. An image whose only import is a delay import of 4. The inventory and the loader stop the descriptor table at different points (proved). The loader stops at the first descriptor with The loader binds only the first. An unreadable name is also skipped silently, where the loader throws. 5. The report's "unimplemented thunk" column counts host-bound imports (proved). Every unregistered import goes there, including 6. 7. (reasoned) Ordinal 1 of the host Checked and found correct, for normal
|
|
All addressed in 1. 2. classify parity — 3. Delay imports — directory 13 is now read (IMAGE_DELAYLOAD_DESCRIPTOR, RvaBased/IAT/INT checks matching 4. Table termination — the descriptor loop now stops at 5. Host vs thunk — the report now mirrors the routing order: registered → 6. 7. xaudio2_9 ordinals — Verified: Generated with Devin |
Flyander
left a comment
There was a problem hiding this comment.
Checked at 249b7065ddb4db971e318d195da6eec96a2265ff. The existing test_import_inventory.py suite passes (24 tests), but two synthetic PE/list-input cases expose report mismatches with the loader:
-
Shared lookup-table RVA drops later descriptors. I built a synthetic PE with
gameinput.dllandother.dlldescriptors pointing to the same lookup table containingGameInputCreate.pe_imports()returns only[('gameinput.dll', 'GameInputCreate')]; the second descriptor is omitted becauseseen_tablesskips the RVA before associating its symbols with that descriptor's DLL.Loader::bind_imports()callsbind_thunks(dll, ...)for each descriptor, so it resolves each DLL's IAT separately. This hides a real import association and can produce the wrong per-DLL binding/coverage report. Please cache parsed symbols per lookup RVA, then emit them for each descriptor DLL, while keeping a bound on total work/output. The currenttest_shared_thunk_table_is_walked_onceencodes the incomplete one-DLL result and should assert both associations. -
DLL-name normalization differs from the loader.
parse_import_lines(['GameInput!GameInputCreate'])produces('gameinput', 'GameInputCreate');summarize()reportsother/host, althoughpe_loader.cpp::dll_key('GameInput')resolves togameinput.dll, where this import is registered and classified HRESULT. The PE path likewise only lowercases DLL names. Please apply the loader'sdll_keynormalization to report comparison/classification keys (and add cases for a bare name and a trailing dot).
|
At
The tests look like they were written against an older shader-stage API. Pointing them at the current AI-assisted (Devin); Linux, Python 3.12.16, no GPU or game files. |
…s per DLL Review findings on ItsNotRexed#2490: descriptors sharing one lookup table lost the later DLL's association (the walk was deduplicated before the DLL was attached), and names like "GameInput" or "gameinput.dll." reported as a "gameinput" host module while the loader keys them gameinput.dll. Lookup tables now parse once per RVA into a name cache and emit per descriptor, matching the loader's per-IAT binding; the emitted pair count stays under MAX_TOTAL_ENTRIES. DLL names go through a port of pe_loader.cpp's dll_key (basename, lower, one trailing dot dropped, .dll added when there is no extension) at both input boundaries and in summarize(), so the report groups and routes on the loader's key. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Addressed in 1. Shared lookup-table RVA — tables now parse once per RVA into a symbol cache and emit per descriptor, matching the loader's per-IAT binding: your two-descriptor case reports 2. DLL-name normalization — ported
Also in this push:
Real-image check: ran Generated with Devin |
|
One more upstream-drift fix on top (fcbe7b7): |
|
@NolanCotter fcbe7b7 duplicates #3883 (claimed in #3796, open since earlier today). It re-anchors the same The two edits rewrite the same lines, so whichever lands second conflicts. Could you drop fcbe7b7 from this PR, since it's otherwise about the loader and shims, and leave the anchor to #3883? |
a8acad0 to
6e81f46
Compare
|
Update — the console-ABI chain landed on this branch (claim: #3381). The D3D12 side of the
Tested (clang-cl 20 + xwin cross-build, Wine)
Remaining gaps posted as Written with AI assistance (Devin). |
|
You're right — I missed #3883 when scanning open PRs for the mutation-anchor fix. Dropped fcbe7b7; the branch is now 425059b's stack rebased onto the shared fork history (current head cf2a45f, which is the collaborator shim/docs work — no test_mutations change from me). Leaving the re-anchor to #3883. |
…nd preserve ClearDepthStencilView FLOAT Depth device slots 17-24, and ItsNotRexed#2490 wraps console-ABI command lists in ListProxy, but neither wires translate_cpu_handle into the five graphics command-list methods that consume CPU descriptor handles: - console slot 50 (PC 46): OMSetRenderTargets (RTV array / single-range + DSV) - console slot 51 (PC 47): ClearDepthStencilView (DSV handle) - console slot 52 (PC 48): ClearRenderTargetView (RTV handle) - console slot 53 (PC 49): ClearUnorderedAccessViewUint (CPU handle; GPU kept) - console slot 54 (PC 50): ClearUnorderedAccessViewFloat (CPU handle; GPU kept) Also installs a typed WINAPI thunk for console slot 51 (ClearDepthStencilView): on the Windows x64 ABI, FLOAT Depth (4th argument) is passed in XMM3 rather than R9, so the generic all-uint64_t list_slot template dropped/clobbered Depth before forwarding to the real list. Adds synthetic mock coverage across all five slots (including single-range RTVs, null/zero-RTV cases, count > 8 bounds safety, outside-range passthrough, and XMM3 float preservation) plus an end-to-end WARP/Vulkan GPU clear and readback check in device_proxy_test. (cherry picked from commit 0aba6c3)
…its frames in A GDKX title makes its own top-level Win32 window before its first PresentX, and PresentX names no window: on the PC the frames belong in that window. Measured on a retail executable: by the first PresentX the process has one visible, unowned top-level window on a thread of its own, and only hidden windows besides (IME, a driver's dummy window). The PresentX wiring (ItsNotRexed#2490) built a hidden window of its own instead, so a running title showed a blank window. find_title_window picks the visible, unowned, non-tool top-level window of the process with the largest client area. It sends no message: a lookup that read window titles with GetWindowTextW (a WM_GETTEXT sent across threads) stopped the retail title at its first PresentX, because the title's window thread was not pumping at that moment. title_window_test makes the windows on a thread that never pumps; the negative control shows a sent WM_GETTEXT times out there, while the lookup answers at once and skips the larger hidden, owned and tool windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
No game files. AI-assisted (Claude Code). |
|
measured: on this stack, adding this PR alone turns a clean stop into a deterministic crash at device slot 15 This is an A/B on one base, so the only difference between the two rows is this PR. Windows 11, MSVC 19.44, RTX 5070, Base:
What the crash actually is. I instrumented the device proxy's generic forward for slot 15 and got: So the dispatch is well-formed: it is our own proxy, the real device and vtable are valid, and the target resolves My reading, and it is a reading rather than a measurement: slot 15 of the vtable this proxy is calling is being entered What I changed to get this PR to build on that base, so you can reproduce it exactly: two conflicts, both unions — I am not touching the PR. Reproducer is deterministic (2/2 both rows), and the probe that names the symbol is the Slot numbers, symbol names and outcome only; no game data. |
|
Correcting the conclusion of the A/B above — the crash is the next stop, not something this PR introduces. I ran the same base with #7076 instead of this PR, and got the same result: So the honest reading is: any PR that carries the title past the command-list stage arrives at device slot 15 and dies there. The A/B I posted showed that this PR reaches the crash earlier than a clean stop, but it did not show that this PR causes it — two different PRs do. What stays true and useful: the crash is a call through our own device vtable slot 15 that resolves to Sorry for the extra comment; the first conclusion was not supported by the third data point. |
|
Code read of
Not run: code read only, no game data. |
…o ExecuteCommandLists Squashed from ItsNotRexed#7286 by Vadson159, head e925b63 (security scan PASS). Conflicts with ItsNotRexed#7290 (fence slot 12): the queue and fence slot constants are both kept, the header's queue/fence paragraph names slot 35 and fence slot 12, and the refused-tail loops skip both (queue_slot_overridden, fence slot 12). Reviewers' unwrapping bug (a list proxy reaching ExecuteCommandListsX) does not apply here: command lists are not wrapped in this tree (ItsNotRexed#2490 is not in).
…load arena, PC-list fixture path Squashed from ItsNotRexed#2490 by NolanCotter, head ef9d075 (security scan PASS). Taken at ef9d075, after upstream's revert (57c1753): this head keeps device proxies made by direct callers on PC-shaped lists (the run_tiny_frame regression), maps the console list IID, wraps slot-73 lists, and routes console list slot 139 (Reset) to PC slot 10. Security: prescan no flags, Haiku read PASS; the IID header cites a GPL-3.0 project as a second source for one GUID value measured from the executable (provenance note, no code taken). Conflicts with Wave 2: the queue proxy keeps ItsNotRexed#7286's ExecuteCommandListsX (slot 35) ahead of this PR's console-layout detection, SignalX and PresentX, and queue_execute_command_lists now unwraps list proxies the way this PR's slot-10 path does (with list proxies in play, ItsNotRexed#7286's early return would have handed the real queue proxies, as ItsNotRexed#7286's reviewers predicted); fence slot 12 (ItsNotRexed#7290) and allocator slot 9 (ItsNotRexed#7949) stay in front of the queue block; device_slot_overridden takes slot 12 with the Wave 2 slots. Tests: queue_proxy_test and the mock's check_tail keep fence slot 12 and expect this PR's S_OK queue tail except overridden slots (35); the mock Kind enum keeps heap and list; the check list takes the union.
…T depth; list view counts are 32-bit (ItsNotRexed#2490 review) Console list slot 51 forwarded PC ClearDepthStencilView through the integer thunk: the FLOAT depth travels in XMM3, which that thunk does not declare, and note_list_slot's first-call log clobbered it, so the first clear of each process took depth 0.0 (reproduced by Hiiva on ItsNotRexed#2490). The slot now has a typed WINAPI thunk. IASetVertexBuffers/SOSetTargets (console 48/49) read their UINT count from the low 32 bits of the register, as UnwrappedArray::fill does (review finding 6 on ItsNotRexed#2490).
…it now unwraps them (ItsNotRexed#7286 x ItsNotRexed#2490) With ItsNotRexed#2490's list proxies, queue slots 10 and 35 both copy the list array and replace each list proxy by its real list, which reads every entry's vtable. ItsNotRexed#7286's check passed made-up addresses and faulted there; it now passes two readable non-proxy objects and checks that the mock's ExecuteCommandLists received them unchanged (the mock records queue slot 10's array).
…(out, proxy) on heap slot 8 and queue slot 18 Squashed from ItsNotRexed#8191 by auswhalen999-debug, head fb31ff1 (security scan PASS). Applied as the PR's own diff (gh pr diff); head fb31ff1 as rescanned. Against ItsNotRexed#2490's queue proxy: the console C-ABI GetDesc check (out in RCX, queue proxy in RDX) runs first in the queue dispatch, before note_child_slot and ItsNotRexed#2490's layout detection, which would otherwise read the caller's buffer as a proxy; a proxy in RCX still takes ItsNotRexed#2490's slot-18 path (newer-layout frequency getter, or PC GetDesc). Mock: Kind keeps heap and list; the heap slot 8 and queue slot 18 GetDesc cases follow the existing heap/queue cases; check_get_desc_c_abi joins the list.
…namic statics in d3d12_xs, d3d12_xs_device and xgameruntime_offline Squashed from ItsNotRexed#8178 by piyonchu, head aefa7be (security scan PASS). Applied as the PR's own diff (gh pr diff). One pattern per file: d3d12_xs.cpp keeps ItsNotRexed#7957's global INIT_ONCE helpers (already on main), so this PR's local-static INIT_ONCE versions there are not taken; d3d12_xs_device.cpp and xgameruntime_offline.cpp take this PR's INIT_ONCE form. The device vtable's INIT_ONCE keeps ItsNotRexed#7078's slot 25/56 struct-return entries (this PR's version predates them), and ItsNotRexed#2490's list vtable gets the same INIT_ONCE form, since lists are made on title threads.
…ins the older queue layout first (ItsNotRexed#8191 x ItsNotRexed#2490) ItsNotRexed#8191 was written against a queue proxy without ItsNotRexed#2490's layout detection. With it, an undetected queue answers PC-order slot 18 as the newer layout's frequency getter, which writes 8 bytes and cannot overrun the caller (ItsNotRexed#2490's rule, kept). The check now calls slot 16 with an out pointer first, which pins the older layout, where PC-order slot 18 is GetDesc. The console C-ABI GetDesc path that the retail title takes is unchanged.
Summary
Follow-up batch after #1912 (claim: #1902 (comment)). 12 commits, all new files or small self-contained changes; no game data.
Runtime / loader
runtime/shims/registry.cpp: console ordinal-import classification —xaudio2_9.dll!#1(XAudio2Create) andgameinput.dll!#1(GameInputCreate) classify as HRESULT so unimplemented imports reportE_NOTIMPLinstead of faking success (+unimplemented_policy_testchecks)runtime/src/pe_loader.cpp: fix — unregistered imports on shim-owned DLLs (xgameruntime,gameinput, ...) could bind to the host namesake (the live PC Gaming Services runtime). They now follow the pseudo-handle path and go unimplemented. +docs/import_routing.md(bind order,owns_dll, per-DLL outcome)Docs
docs/console_libraries.md: catalogue of the console-DLL surface (d3d12_xs,xg_xs,AcpHal,dstorage_xs,chad/xapu/xcrdapi, ...) and per-module shim statusdocs/hello_pixels.md+ index rows@NolanCottermaintainer)Tools
tools/import_inventory.py: stdlib PE32+ import parser — mapsdll!function/ ordinal imports to shim-layer coverage per module (mirrorsregistry.cppclassification); 18 teststools/hello_pixels.py: package-free complement to first_light — assembles hand-written SPIR-V (spirv-as only), draws a generated quad throughVKH_DRAW_MESH, writes PPM+PNG,--checkoracle verifies coverage + probe pixels against the pattern's closed formTests (~1,400 lines):
test_hello_pixels,test_import_inventory,test_run_gpu_tests_helpers,test_make_game_shader_state,test_viewer_serveadditions,test_spirv_interface,test_wave64_halves_operands, and semantic fixtures fors_cmpk_*/s_wqm_b32/ ALU / f16-transcendental ops.Tested
python -m compileall -q make_game.py tools tests✅test_hello_pixels9 ✅ ·test_import_inventory18 ✅ ·test_run_gpu_tests_helpers25 ✅ ·test_make_game_shader_state40 ✅ ·test_viewer_serve38 ✅ ·test_spirv_interface28 ✅ ·test_wave64_halves_operands23 ✅python -m unittest discover -s tests/semantic— 1,694 tests OK (incl. new fixtures; expected values verified against the translator's own interpreter)hello_pixelsend-to-end: Mesa llvmpipe (LLVM 20.1.2), Vulkan 1.3.275, Linux — 512×512 draw, 100% coverage, all probes passtest_i18n_index,test_docs_links✅Caveat: the
registry.cpp/pe_loader.cppchanges are Windows-only C++ and were not compiled locally (Linux box) — same situation as the #1912 classifier change that adriaespii verified on MSVC. CI or a Windows check appreciated.AI assistance
Written with AI assistance (Devin + delegated workers); all test expectations verified by execution, not hand-trust.
Checklist