Repository navigation
runtime: xg_xs.dll shim, XGCreateTextureComputer and XGSuggestSwizzleMode as traced E_NOTIMPL (RT-489) - #6891
Conversation
|
Independent Windows 11 check at head
|
devnull34
left a comment
There was a problem hiding this comment.
Hardware & Environment
- Host: Windows 11 Build 26300 x64
- Toolchain: MSVC 19.44 (Visual Studio 2022), CMake 4.4
Verification Summary
Targets compiled with MSVC 19.44 and executed natively:
-
**\xg_xs_test.exe**:
- Passed with 16 checks, 0 failures.
- Verified that \xg_xs.dll\ is owned by the shim registry.
- Verified that \XGSuggestSwizzleMode\ returns \E_NOTIMPL\ while preserving caller input buffers.
- Verified that \XGCreateTextureComputer\ rejects null output pointers with \E_POINTER, returns \E_NOTIMPL\ while handing out a safe dummy computer object for callers that don't check return codes.
- Verified that texture computer vtable slots (slots 2, 8, 10, 31) trace one-shot diagnostics and return \E_NOTIMPL\ safely without corrupting caller memory.
-
CTest:
- \xg_xs: Passed (0.01s).
-
Hygiene & Compliance:
- Clean-room compliant: pure synthetic unit tests; zero game assets or proprietary code.
- \git diff origin/main..HEAD --check: Clean (0 whitespace/formatting defects).
LGTM!
shayderrr
left a comment
There was a problem hiding this comment.
Summary
Adds runtime/shims/xg_xs.cpp: XGSuggestSwizzleMode and XGCreateTextureComputer return E_NOTIMPL with once-only caller logging. The latter deliberately still stores a static 32-slot vtable computer in *out because two measured executable call sites use it without checking the HRESULT; slots 0/1 are no-op AddRef/Release, all others log and return E_NOTIMPL without writing outputs. runtime/CMakeLists.txt registers the shim, an xg_xs_test target and a CTest. runtime/test/xg_xs_test.cpp covers registration, mode-field preservation, null-out and slots 1/2/8/10/31. Docs add the xg_xs note and add xg_xs.dll to owns_dll.
Why merge
Closes two of the 30 unimplemented imports from #6715 with behavior derived from static call-site reading, preventing null-pointer calls while staying honest about missing console texture layout. Synthetic Windows tests pass.
Verdict: Approve
SummaryAdds Why mergeCloses two of the 30 unimplemented imports from #6715 with behavior derived from static call-site reading, preventing null-pointer calls while staying honest about missing console texture layout. Synthetic Windows tests pass. Verdict: Approve |
|
Tested This adds the full suite on a newer MSVC to @soldsawn's 19.44 run of
|
a9278c9 to
cc26796
Compare
|
Rebased onto main AI-assisted (Claude Code). |
|
Tested
|
…_NOTIMPL) for the boot test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested on the retail boot: pass. Own 1.0.2.1 copy, Windows 11, RTX 4090 / 617.42,
So the design choice to store a computer in |
|
Tested |
|
Thanks for the Wine run. I am leaving slot 2 as it is, for this reason:
AI-assisted (Claude Code). |
|
Tested Built |
…shapes - XGCreateTextureComputer: fix signature from 4 args (desc, device, riid, out) to the measured 2 args (desc, out**). The out pointer arrives in RDX, not R9 — the old 4-arg version wrote through a stale register as textureComputer, which the two callers that ignore the HRESULT would use as a null/wild vtable call. Now returns a static computer with a proper vtable (AddRef/Release for slot 0/1, E_NOTIMPL for all other slots with a one-time log). - XGSuggestSwizzleMode: fix signature from 2 args (desc, mode*) to the measured 3 args (desc, flags, mode*). The mode* arrives in R8, not RDX, so *mode = 0 was previously writing to a wrong register. Now returns E_NOTIMPL and writes nothing (the caller already zeroed the field). - AcpHalCreate: replace the non-dereferenceable id<<4 handle with a static object with a proper vtable (IAcpHal COM-like interface). Any method call through it logs once per slot and returns E_NOTIMPL instead of faulting. Both fixes match the measured call shapes documented in the overlapping PRs ItsNotRexed#6891 and ItsNotRexed#6981 and verified by reviewers. AI-assisted: yes
|
checked: merged #6891 squash 23060e0 on Wine/RADV, as a single addition to our frozen #7323 diagnostic stack. Full base and combination choices are linked there. Arch Linux, Wine 11.18, RX 7900 XT / RADV Mesa 26.2.3, clang-cl 23.1.6 + xwin; same shader library and 30-second offline sandbox, display enabled, no assertion skipping. The shim and its test are byte-identical to the merged commit. CMake hunks applied with offsets; the documentation conflict kept both xg_xs and DirectStorage modules. No production adaptation. Build passes; xg_xs reports 16 checks, zero failures. Selected suite: 46/51, all eight proxy modes, tiny-frame, unimplemented policy, loader and shader-library checks pass. The same five earlier failures remain (native-abort expectation, missing-TMP TLS refusal, two Wine WARP device checks, old mesh Close). The previously reported #7115 host-caller regression is also a known limitation outside this subset. One bounded retail comparison: the previous intentional XGSuggestSwizzleMode unimplemented-import stop is gone. XGSuggestSwizzleMode, XGCreateTextureComputer and computer slot 8 report E_NOTIMPL; the title continues past all three. This does not establish texture layout or copy correctness: those operations remain unimplemented by design. The run reaches 2,261 D3D12 trace calls (1,636 ok, 40 void/called, 585 unsupported CreateLifetimeTracker calls). Separately, 42 slot-67 pipeline attempts report missing translated FSPX-form programs and E_INVALIDARG; their source and relation to the crash are unestablished. After device slot 108 is first logged, the run ends with an execute access violation on the main thread: init 0/run 5, no timeout. No usable host frame in the debugger backtrace. The first fault is not attributed to the XG shim, failed pipelines or slot 108 without another controlled comparison. Source/patch and matching binary/PDB/DLL hashes verified. Inputs and raw traces remain local. #7323's S_OK stand-in is still present; this is a diagnostic integration result, not a gameplay or full-suite pass claim. AI-assisted testing (Claude), review/reporting (Codex). |
|
Post-merge heads-up from routine issue triage at main 867d922: your 23060e0 added xg_xs.cpp to add_executable(gta6rt ...) in runtime/CMakeLists.txt:111 but not to scripts/build_runtime.ps1's $files list — tests/test_build_runtime_fallback.py is RED on main comparing the two lists. One line in the .ps1 fixes it. AI-assisted: yes. Tested on Linux (RTX 5080 host), code-side check. |
|
An offer for RT-489, which is yours, not a competing PR: a real layout computer behind these two exports, on top of this shim. It keeps your registration, the computer that is always stored, and the once-only log for unserved slots: main...seblessa:Leonida:xg-layout-upstream
One known gap: the D3D12 device's slot 25 can report less memory than the console layout needs, so a copy could run past it. That's on the device-proxy side, not here. Tested on an RTX 4080 SUPER (driver 617.42, Windows 11 26H2): the xg tests pass 2 of 2, and AI-assisted (Claude Code). |
…eComputer and XGSuggestSwizzleMode as traced E_NOTIMPL (RT-489) Squashed from ItsNotRexed#6891 by Jadiac5, head c4c51dc (security scan PASS).
|
Native Windows retail follow-up for Control was 1,666 D3D12 calls and an unimplemented XGSuggestSwizzleMode stop. With this shim, two RTX 5090 runs both reach 2,269 calls, ending at two unsupported slot-133 texture placements in the older #7218
A separate run on the integrated AMD Radeon Graphics ends earlier at 1,640 calls with an unhandled C++ exception. Cause not diagnosed; I am not treating it as a regression from this shim or as successful AMD coverage. Windows 11 build 26300, RTX 5090 / 32.0.16.2124, clang-cl 21.1.8 + xwin SDK 10.0.26100, static CRT, Vulkan backend. Socket/DNS/transmission debugger guards active; no assert skipping. Vulkan validation layer unavailable. No game files, shaders, raw traces or title addresses attached. AI-assisted (Codex). |
xg_xs: serve XGCreateTextureComputer and XGSuggestSwizzleMode as traced E_NOTIMPL
Item: RT-489, the
xg_xs.dllshim (2 of the 30 unimplemented imports listed in #6715). Claim:#6750 (comment)
What the imports are for
xg_xs.dllis the console's texture layout library. The game executable imports two functions from it. Todayboth resolve to the unimplemented thunk, which returns 0 (S_OK) and writes nothing. Callers then call through an
out pointer that was never written.
What the call sites show (static read of the executable, shapes and counts only)
XGSuggestSwizzleMode(desc*, 0, uint32_t* mode): 2 call sites, both in the game's helper that fills a texturedescription.
modepoints to a 32-bit field of that description. The helper sets the field to 0 first, andwrites
0x100 | modeitself when it already knows the mode. The HRESULT is only passed back up. No callerbranches on it.
XGCreateTextureComputer(desc*, computer** out): 4 call sites. Two test the HRESULT and take their failure pathwhen it is negative. Two ignore it and call through
*outat once.to a large stack structure (2 sites), slot 8 with six arguments in a loop over subresources (1 site) and slot 10
with seven arguments (1 site). No site reads the return value of slots 2, 8 or 10. No site calls slot 0.
What the shim does now
The runtime has no model of the console resource layout.
runtime/src/gfx10_tiling.hcovers two swizzle modes ofone 2D level, without mips or the structure slot 2 fills. So the shim computes no layout:
XGSuggestSwizzleModereturnsE_NOTIMPLand writes nothing. The field keeps the 0 the caller put there.XGCreateTextureComputerreturnsE_POINTERfor a nullout. Otherwise it returnsE_NOTIMPLand still storesone static object in
*out. The two checking callers fail cleanly. The two that don't check get an object theycan call, instead of a null pointer. COM says
*outis null on failure. This breaks that on purpose, for thesecallers.
once and returns
E_NOTIMPL. It writes nothing through its arguments.SHIM_TABLE, soowns_dll("xg_xs.dll")is true. Added to thegta6rtsources.docs/runtime_imports.mddescribes it and adds it to the owned-module list.Hypothesis, not measured: that slots 0 and 1 are AddRef and Release; what slots 2, 8 and 10 mean; and that no
caller reaches a slot above 31. At one site the object is stored in another object and may be called later from
code this read did not follow.
Effect: a texture whose layout the game asks for is not laid out (slot 8 does not copy). This shim is meant to get
past boot without a crash, not to make textures right.
Tests
xg_xs_test(synthetic, no game data): 16 checks, 16 pass. It resolves both exports throughrt::shims::findand checks ownership, the return values, that the mode field is untouched, that the computer isstored, and that slots 2, 8, 10 and 31 return
E_NOTIMPLwithout writing their buffers. It also checks thatextra Releases are harmless.
cteston xg_xs, xmem, unimplemented_policy, loader, pe_loader, loader_tls, process_cmdline, file_system:8 of 8 pass.
gta6rtbuilds and links with the new file.python -I tests/test_docs_repo_paths.py: OK.python -I scripts/check_no_game_data.py: exit 0.Not tested: not run against the retail executable. The full ctest suite was not run.
Tested on Windows 11, MSVC 19.44 (AMD Radeon RX 9070 XT, driver 32.0.32029.2010; the tests use no GPU).
AI-assisted (Claude Code).