Repository navigation
d3d12_xs: console-ABI command lists, upload arena, PC-list fixture path - #2490
NolanCotter wants to merge 2 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. |
|
@gertify both addressed — and a clarification on which head you ran:
|
Kam471
left a comment
There was a problem hiding this comment.
- #5731 reworks the loader host-binding fix and module identity. At
2e0f1a297it passes 8/8 loader ctest — includingrun_tiny_frame(OK), the regression that caused this PR to be reverted — plusloader90 checks,unimplemented_policy105,pe_loader_bounds54. A static import ofxgameruntime.dll!XErrorReportnow reports UNIMPLEMENTED instead of binding the System32 namesake, andGetModuleFileNameW(NULL)returns the mapped guest path. - #5732 is the tooling half (
import_inventory,hello_pixels), stacked on #5731.
Recommend closing this in favor of the two slices; the reverted history is preserved in the commits.
|
@Kam471 this one isn't superseded — it's the third slice of the split. Per the maintainer's request the original PR became three pieces:
Current diff vs Happy to retitle again if the current title doesn't make the slice scope clear enough — what would help? |
|
Native RTX 4080 retest of the split console ABI at |
|
@CryingLaughing thanks — that's the first full trace verification on the split slice specifically, and it confirms the console-ABI work stands alone after the rebase: |
|
Tested the new head
AI-assisted (omp coding assistant). |
|
@shipped-it the strict same-environment A/B is what this slice needed — 7/7 Wine failures identical on |
The d3d12_xs shim's device now hands callers console-shaped command lists (160-slot vtable, object body at +0x18 with the write cursor pinned at the record limits, console slots 27-30 recorded not forwarded, slot map measured to the PC table: 60->58, 61->59, 146->80). Queue layout detection is atomic and device-wide; SignalX (slot 23/25 by layout) forwards as Signal, PresentX (30/32) reaches the presentation core, and ambiguous slot 18 serves the timestamp- frequency getter until the layout is proven. AllocateUploadMemory (console slot 148) carves a bump arena out of persistently-mapped UPLOAD-heap buffers; the six root-VA setters and the IA/SO view setters translate arena pointers to buffer device addresses in proxy-owned copies. Impossible sizes and non-power-of- two alignments are refused before any arithmetic that could wrap. PC-compiled callers opt into real PC-shaped lists with console_lists=false on create_device_proxy, and PC-compiled guests with LEONIDA_D3D12_LISTS=pc — the fixture path check_tiny_frame.py sets, so a guest ClearRenderTargetView at PC slot 48 reaches the real list. The GPU tests take the flag; unmeasured console slots stay console-shaped for the title path. docs/d3d12_xs_console_abi.md records the measured ABI. Split from ItsNotRexed#2490 (third of three): fixes the run_tiny_frame failure the revert reported. AI-assisted. Hardware verification on the earlier identical code is in ItsNotRexed#2490's thread (RTX 3060 Ti-5080, RX 7600/9060/9070/7900 XT, Intel UHD, RADV; 177/177). Wine/clang-cl on the build host: xs_proxy_mock PASS incl. the overflow regression, queue_proxy child-runner section fails identically on unmodified main (Wine env), loader_test 86/0 upstream count. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Rebased onto current main |
The d3d12_xs shim's device now hands callers console-shaped command lists (160-slot vtable, object body at +0x18 with the write cursor pinned at the record limits, console slots 27-30 recorded not forwarded, slot map measured to the PC table: 60->58, 61->59, 146->80). Queue layout detection is atomic and device-wide; SignalX (slot 23/25 by layout) forwards as Signal, PresentX (30/32) reaches the presentation core, and ambiguous slot 18 serves the timestamp- frequency getter until the layout is proven. AllocateUploadMemory (console slot 148) carves a bump arena out of persistently-mapped UPLOAD-heap buffers; the six root-VA setters and the IA/SO view setters translate arena pointers to buffer device addresses in proxy-owned copies. Impossible sizes and non-power-of- two alignments are refused before any arithmetic that could wrap. PC-compiled callers opt into real PC-shaped lists with console_lists=false on create_device_proxy, and PC-compiled guests with LEONIDA_D3D12_LISTS=pc — the fixture path check_tiny_frame.py sets, so a guest ClearRenderTargetView at PC slot 48 reaches the real list. The GPU tests take the flag; unmeasured console slots stay console-shaped for the title path. docs/d3d12_xs_console_abi.md records the measured ABI. Split from ItsNotRexed#2490 (third of three): fixes the run_tiny_frame failure the revert reported. AI-assisted. Hardware verification on the earlier identical code is in ItsNotRexed#2490's thread (RTX 3060 Ti-5080, RX 7600/9060/9070/7900 XT, Intel UHD, RADV; 177/177). Wine/clang-cl on the build host: xs_proxy_mock PASS incl. the overflow regression, queue_proxy child-runner section fails identically on unmodified main (Wine env), loader_test 86/0 upstream count. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
test_every_variable_is_named_in_a_document fails when a code-used environment variable is documented nowhere. The variable is described in the command-list section where the two list layouts are defined. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Rebased again onto |
devnull34
left a comment
There was a problem hiding this comment.
Verified at head 2abf0cd on Windows 11 with MSVC 19.44 on AMD Radeon RX 7900 GRE (RDNA3, gfx1100):
- Build: Clean compile and link for targets xs_proxy_mock_test and queue_proxy_test with 0 warnings/errors.
- xs_proxy_mock_test.exe: PASS (9 allocations refused on purpose). Verified console-shaped list ABI (160-slot vtable, cursor pinning, dispatch/extras forwarding), bump arena AllocateUploadMemory bounds checking, and queue detection.
- queue_proxy_test.exe: PASS (3 backend(s) passed: Vulkan device proxy, queues, fences in both release orders, no leaks, copies through queue proxy read back intact, residency unwrapped).
- Formatting: git diff --check 338f242..HEAD is clean with no trailing whitespace or leftover conflict markers.
No retail game files or keys used.
AI-assisted verification.
|
Independent native Windows 11 check of 2abf0cd9. RTX 3080 Ti, NVIDIA 621.35, MSVC 19.44, Vulkan SDK 1.4.363.0. The stock AI-assisted. |
Shim-owned modules (xgameruntime, gameinput, d3d12_xs, xmem) no longer bind to their real System32 namesakes in resolve() or forwarded exports — an unregistered console import now ends unimplemented instead of reaching a host Gaming Services call. LoadLibrary's file-name rule keys imports so "TestShim", "testshim.dll." and "testshim.dll" hit the same shim. registry gains the ordinal classes: gameinput ItsNotRexed#1 and xaudio2_9 (ItsNotRexed#1, and host-only ItsNotRexed#8-ItsNotRexed#10) classify as HResult. GetModuleHandle(nullptr) answers with the mapped main image and GetModuleFileNameA/W answer for bundled modules' stored paths (Win32 spelling, Z: under Wine) through two new BundledModuleOps. loader_test pins the name-rule binding; unimplemented_policy_test pins the ordinal classes. Split from ItsNotRexed#2490 (first of three). AI-assisted. Tested on the build host under Wine/clang-cl: loader_test 88/0, unimplemented_policy_test 96/0. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@devnull34 thanks — first |
|
@thehollowedone thanks — another clean native pass on |
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