mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #2] [MERGED] D3D12: fix the slot-14 and acphal build breaks, report slot-133 texture GPU VAs #62
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#62
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2
Author: @ExCorvus
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism
Base:
main← Head:fix/d3d12-build-breaks-and-texture-va📝 Commits (3)
db761beruntime: give acphal's SHAPE contexts their GDK trailing wordsa7ffc53d3d12_xs: route console slot-14 heap creation through a registered handlerf9c6857d3d12: slot 133 textures answer GetGPUVirtualAddress with the title address📊 Changes
8 files changed (+98 additions, -34 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+10 -1)📝
docs/retail_boot_chain.md(+6 -4)📝
runtime/shims/acphal.cpp(+2 -2)📝
runtime/shims/d3d12_vulkan_device.cpp(+37 -15)📝
runtime/shims/d3d12_xs_device.cpp(+14 -4)📝
runtime/shims/d3d12_xs_device.h(+9 -0)📝
runtime/test/d3d12_console_descriptor_heap_test.cpp(+13 -5)📝
runtime/test/d3d12_existing_heap_test.cpp(+7 -3)📄 Description
D3D12: fix the slot-14 and acphal build breaks, report slot-133 texture GPU VAs
Claimed in the coordination issue as: none exists yet.
ubiquitarianism/leonidahad0 issues and 0 pull requests when this was written (
8eee35cfd);CONTRIBUTING.mdstill linksthe "Coordinating who works on what" issue in the deleted
ItsNotRexed/Leonidarepository, whichnow returns 404. This PR is the claim. If a coordination issue is recreated, I will move the claim
there; otherwise please treat this line as the claim record.
Depends on: none. Based on
8eee35cfd(continuation/main); the merge-base with the lastpre-continuation commit is
2d53a8055.AI-assisted: yes (DeepSeek V4.1 Flash 1017 / Alibaba Token Plan; coordinated by Qwen4 Max
Preview).
What and why
Three independent fixes. The continuation delta (
2d53a8055..8eee35cfd, 35 commits) touchesnone of the files below, so this applies and behaves the same on
8eee35cfdas it did on thebase.
runtimeacphal.cppdoes not compile: the GDK size asserts fail (60/28 vs 64/32).d3d12_xs3630610cadoes not compile (C3083/C2039) and its test does not build.d3d12GetGPUVirtualAddresswith 0, so the title's texture clear writes at address 0.Recommended commit order is 1, 2, 3 (both build breaks first, then the behavior change). If you
prefer smaller changes, commits 1-2 can land as a build-fix PR before commit 3.
1.
runtime: acphal SHAPE context sizesccd36246fadded the GDK static asserts, but the published field lists leaveSHAPE_XMA_CONTEXTat 60 bytes andSHAPE_PCM_CONTEXTat 28, so the file fails itsstatic_assertchecks (C2338) andgta6rtdoes not build. The GDK layouts have one trailingreserved word that the lists omit:
reserved[11]for XMA (64 bytes) andreserved[2]for PCM(32 bytes). The words are unused; this only restores the ABI size.
File:
runtime/shims/acphal.cpp.2.
d3d12_xs: console-extended slot 14 compiles and links again3630610ca("report console descriptor heap address on Xbox slot 14") calledrt::d3d12::create_console_descriptor_heapfromruntime/shims/d3d12_xs_device.cppwithoutincluding
d3d12_com.h; the namespace is unknown there:Including
d3d12_com.his not an option: it pulls Vulkan types intoxs_proxy_mock_test, whichcompiles
d3d12_xs_device.cppalone and does not link the Vulkan layer. The fix uses the samehandler pattern as slot 133:
ConsoleDescriptorHeapHandlerandset_console_descriptor_heap_handlerind3d12_xs_device.h, backed by an atomic ind3d12_xs_device.cpp;rt::d3d12::create_console_descriptor_heapin its constructor;Device::create_console_descriptor_heapowns the heap construction, so the free helper onlyunwraps the proxy's real device and delegates.
The new test needed three repairs independent of the handler:
Ref::operator->, correctcreate_device_proxyreference ownership (the function takes one reference on success), andreading the PC heap start through
heap_proxy_real_heap()rather than the proxy's Xbox-ABIGetCPUDescriptorHandleForHeapStart(which answers in RAX).3630610ca's stated limitation isunchanged: the console address is reported, but title-memory/section 3.3 aliasing is still TODO.
Files:
runtime/shims/d3d12_xs_device.h/.cpp,runtime/shims/d3d12_vulkan_device.cpp,runtime/test/d3d12_console_descriptor_heap_test.cpp.3.
d3d12: slot-133 textures report the title address as their GPU VAThe retail title places a 256x256
R32_FLOATtexture through Xbox device slot 133 and then usesID3D12Resource::GetGPUVirtualAddressas the CPU pointer for its clear. On the console everyresource has an address; D3D12 answers 0 for a texture and the title therefore wrote 256 KB at
address 0. XCL measured the same clear and its
res_gpu_va_xreturns the title's placed address(XCL PR #168). Provenance: the behavior was independently reimplemented from our own measurement;
XCL (GPL-2.0-only) is cited as measured prior art only, per
docs/related_projects.md— no XCLcode, tables or comments were copied.
A slot-133 texture still gets the existing committed fallback image, but records the title address
and reports it from
GetGPUVirtualAddress. Ordinary textures still answer 0 (as on D3D12) andbuffers keep their console arena VA. Limitation, stated in the diff and docs: the image does
not alias the title's pages yet, so a write through the returned address does not reach the
texture. That needs the page mapper; it is not hidden by this change.
Files:
runtime/shims/d3d12_vulkan_device.cpp,runtime/test/d3d12_existing_heap_test.cpp,docs/d3d12_vulkan.md,docs/retail_boot_chain.md.Not in this PR: rpf9-explorer pin
A fourth local change bumps
third_party/rpf9-explorerfrome293917toc77f750. It is notpart of this PR:
continuation/mainstill pinse293917, andbb75702bcexplicitly reverted anearlier bump to keep that pin. The bump is asset-view tooling and should be requested separately
if the maintainers want it. The rest of this PR does not depend on it.
Tested
Host: Windows 11, AMD Radeon RX 9070 XT, driver
32.0.32029.2010(Vulkan backend of the D3D12layer).
cmake --build runtime/build --target gta6rt -j 12->gta6rt.exelinked at 2026-11-2400:27:51, after all touched source files (newest 00:27:45).
d3d12_existing_heap_test(covers both slot-133 texture paths and the new VA answer)d3d12_xmem_placed_testxs_proxy_mock_test(compiles the proxy without the Vulkan layer)d3d12_console_descriptor_heap_test(console slot 14 and the proxy's PC ABI)8eee35cfd: each unit applies withgit apply --check; applying thethree included units reproduces the intended tree byte-for-byte (all file blob hashes match), and
the combined check passes. No rebase was needed because the 35 continuation commits change none
of these files.
2d53a8055working tree before the continuation refwas fetched. Since
8eee35cfddoes not touch these files, the patched content is identical, butCI on this PR will be the first full build on
8eee35cfd..github/workflows/ci.ymlselection, run locally withpython -I -m pytest):1848 passed, 21 skipped, 3 failed. All three failures are pre-existing and unrelated to this
diff (C++/docs only): two
test_cf_diffcases hit a translator-unsupported instruction, and onetest_user_sgpr_censuscase assumes case-sensitive paths, which Windows does not provide.in the earlier debugging session and is the same observation recorded by XCL PR #168.
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.