D3D12.X: GetGPUVirtualAddress of a placed texture is its title address #168
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!168
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/168/head"
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?
@ShyVortex on GitHub · 2026-11-23 18:31 UTC · original
ShyVortex:d3d12x/texture-gpu-va→main· +8 −2 · 1 files · 1 commits · closed without mergingSummary
On the console every resource has a GPU address, textures included. On the PC,
GetGPUVirtualAddressof a texture is 0.A retail game turns a 256×256
R32_FLOATtexture's address into the CPU pointer it clears it through. The chain, from its code:0x2913410creates the texture.[tex + 0x10] = 0x4fd2940(tex), which isGetGPUVirtualAddress(vtable+0x58) mapped through the title's unified-memory window.memset([tex + 0x10], 0, w * h * 4).With the PC's 0 it wrote 256 KB at address 0 (
vcruntime140!memset, access violation).The texture is one the title placed at its own address (
CreatePlacedResourceX→ video-memory arena), so XCL already knows that address:title_address(), whichMapuses.res_gpu_va_xonly consultedconsole_buffer(). Now, when the PC answers 0, it returns the resource's title address if there is one. Buffers, and anything that has a PC address, are unchanged.Testing
cargo test --release --workspace: all pass.memseton two runs without this change, and ran past it with it.Draft until one more run confirms nothing later trips on the addresses this now returns.
🤖 Generated with Claude Code
@ryosen0 on GitHub · 2026-11-23 18:40 UTC · original
RTX 3060 Ti (wave32), Windows 11 host,
XCL_NETWORK=0, this branch (070a737): 600 presents, ~26 fps, then the title's ownint3at+0x344196(33 s, warm shader cache) — the same assert site as main @956a476without this change. No new failure before that point attributable to the returned title addresses. Thememsetnull-write this PR fixes does not occur on this machine on either build, so this is a no-regression data point rather than a confirmation of the fix itself.@ShyVortex on GitHub · 2026-11-23 18:44 UTC · original
Thanks for testing!
+0x344196is the assertion afterGetResourceAllocationInfofor a 2560×1440 depth buffer in the console's D16_UNORM_S8_UINT (118): XG has no model for 118, and the PC driver answersUINT64_MAXfor it. Onmainthat stops the game before it reaches this PR'smemset, which comes later in loading. #150 maps 118 for the driver; on my side thememsetonly appeared once 118 was handled (including an XG layout for it, suggested on #150). So this PR is confirmed on my machine with those in place; onmainalone it can't be reached yet.@Sr-0w on GitHub · 2026-11-23 19:36 UTC · original
Tested on AMD (RX, GTA VI retail). One gap: in
create_placed_resource_x, a texture thattitle_textures::registeraccepts returns beforereal::note_title_address, so it never gets a title address andGetGPUVirtualAddressstill answers 0. That is where the 256x256 R32_FLOAT texture came from in my runs: thememsetcrash happened at 35–50 s. Noting the title address in theOk(())arm too fixed it. The game then ran past it to ~63 s (a device removal there, which I am still investigating).🤖 Generated with Claude Code
@Sr-0w on GitHub · 2026-11-23 20:00 UTC · original
Second spot, same crash: textures that
vram::placetakes (render target / UAV textures, e.g. GTA VI's 256x256 R32G32_FLOAT RT+UAV) return fromcreate_placed_resource_xbeforenote_title_addressas well, soGetGPUVirtualAddressstill gives 0 and the titlememsets 512 KB at address 0. Noting the title address on thatSome(hr)path too fixed it here.🤖 Generated with Claude Code
@gw1337x on GitHub · 2026-11-23 20:19 UTC · original
Setup: AMD Radeon RX 7800 XT (RDNA3, 16 GB), driver 32.0.32015.7029, 32 GB RAM, Windows 11 Pro 26200, GTA VI retail,
XCL_NETWORK=0, release build.Test branch:
main956a476+ #170 (incl. #163 @634c423) + #162 @641f551+ #168 @070a737+xg.rsof #169 + #176 + #164.Confirming @Sr-0w's gap (the
title_textures::registerOk(())arm). With that fixed, the game cleared the 256 KBR32_FLOATtexture and then crashed the same way on the next one:memsetof0x80000bytes at address 0 (+0x5ebea38).That's the texture the same init function (
+0x1d957b0) creates right after, through the same helper (+0x2913410): DXGI format0x10(R32G32_FLOAT), 256x256, object at0x1476b42f0. It is GPU-owned (UAV flag), socreate_placed_resource_xreturns from thevram::placearm beforenote_title_address. Noting the title address there too fixed it, and the game got past both:Caveat: for arena textures the title's CPU writes then land in title memory, not in the PC texture. That's harmless for this clear-to-zero, but content written on the CPU wouldn't reach the GPU.
🤖 Generated with Claude Code
@Kalmarv on GitHub · 2026-11-23 20:28 UTC · original
Confirmed the slot-11 fallback on an actual placed texture with a registered title address. I tested PR head
070a7378543b8efac3496e6a344393efadbe30b7directly against its parent956a476bf738a098f39df4f4c8acef682e43030f. Windows x64 MSVC, Rust 1.99.0, RTX 5070 Ti, NVIDIA 610.74, D3D12 debug layer enabled for the native probe.0x1234500000x123450000(pass)hle::d3d12x::testsThe native check created a real D3D12 heap and placed texture, adopted the resource, called
note_title_addresswith a live CPU allocation, then invokedres_gpu_va_xdirectly. On both builds the debug layer recorded message 745 for the native texture VA query. Only the PR head returned the CPU address afterward.The PR adds no test of its own. This checks address selection once registration succeeds. The two creation paths already discussed above, CPU-to-GPU write visibility, retail execution and merge-onto-main were outside this run. AI-assisted review.
@ShyVortex on GitHub · 2026-11-23 20:52 UTC · original
Superseded by
38b05b7onmain:res_gpu_va_xthere falls back to the title address, andcreate_placed_resource_xnotes it in thevram::placeandtitle_textures::registerarms too (the two paths Sr-0w and gw1337x found, thanks to both). Committed textures also get an address on request. Closing.Thanks to everyone who tested this: ryosen0, Sr-0w, gw1337x and Kalmarv.
@ivall on GitHub · 2026-11-23 20:57 UTC · original
Closing: on main a texture's GetGPUVirtualAddress gives its title address when the PC answers 0, and the address is noted on both creation paths named in the review (
vram::placeandtitle_textures::register). A committed texture with no title address gets lazily committed memory at one (from #195). Thanks!@ExCorvus on GitHub · 2026-11-24 10:47 UTC · original
Independent confirmation from the Leonida static-recompilation side (Windows 11, RX 9070 XT, driver 32.0.32029.2010): the same 1.0.2.1 title places a 256x256 R32_FLOAT texture through device slot 133 and clears it through the value GetGPUVirtualAddress returns; with a PC-style 0 answer the clear writes 256 KB at address 0. Leonida folded in the title-address answer for slot-133 placed textures (ubiquitarianism/leonida PR #2, merged), with a committed fallback image and no pixel aliasing yet — the same limitation noted here. Confirming the measurement and the fix direction on RDNA4 as well.
AI-assisted (Qwen4 Max Preview, Alibaba Token Plan); verified and posted by ExCorvus.
Pull request closed