D3D12.X: textures the GPU writes never reach title memory; a title reading them on the CPU gets stale data #2663
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#2663
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?
@joeypercia on GitHub · 2026-11-26 05:30 UTC · original
What the GPU writes into a title texture never reaches the title's memory, so a title that reads such a texture on the CPU gets stale bytes. On the console the CPU and the GPU share memory, so a compute pass can write a texture that the title's own code then reads.
Why it matters for the retail title: the same title on VIctory forks, which got this far into the world, had its boats sinking in every run (and the sea plane going under). The ocean's height and displacement maps are textures that compute passes write and the title's physics samples on the CPU. Reading them back to title memory fixed it (avatarmanz/VIctory-7900XTX docs/findings.md, "Faults found", credited there to Geckomacabre's read-back). VIctory is GPL-3.0, so this is the idea only; no code from it.
What XCL does today (
mainb49be183):vram::place,vram::gpu_owned). Nothing copies its contents to the title's memory at its address.title_textures::note_gpu_writemarks textures that aCopyTextureRegion/CopyResourcewrites, and stops uploading over them. It doesn't copy what the GPU wrote back either (title_textures.rs, around line 466; called fromlist_x.rscopy_texture_region_x/copy_resource_x).vrampages, not in the windows.gpu::tiling::Layout::tile(only tests use it now).Proposal, split as AGENTS.md asks. I'll take it unless someone already has it.
Layout::tileinto the console layout of its console description, and write them to its title address. GPU test: a compute pass writes known texels, and the title memory then holds them in console tiling, checked againstdetileand a CPU reference, for 2D and BCn, mips and array slices.XCL_TEXTURE_READBACK=1: make the CPU read cheap to notice by guarding the title pages under GPU-written textures (PAGE_NOACCESSuntil the next GPU write after the read-back). On the fault, wait for the texture's last writing submission, read it back and restore access. Counters in the activity log: textures guarded, faults, bytes read back, wait time.What I can't show yet: on Windows / NVIDIA, XCL doesn't reach the boat missions, so part 1 is checked by GPU tests and part 2 by synthetic tests plus the counters in title runs. Which other textures the title reads on the CPU, I'll log with part 2.
AI use: Claude Code (Claude Opus 5.5) read the code and wrote this.
@joeypercia on GitHub · 2026-11-26 06:24 UTC · original
A first measurement of whether the newer retail title's CPU touches textures the GPU owns: render targets, depth buffers and UAV textures, which
vram::placeputs in video memory.How: a diagnostic,
XCL_GPU_TEXTURE_TOUCH=1(c6f37e96; a PR follows). The committed pages wholly inside such a texture's console memory getPAGE_GUARDwhen it is placed, and a lazily committed page counts when its first access commits it. The first access to each texture is logged with the code address.Run: RTX 4070 Ti (12 GB, driver 621.40),
nvidia-devc044dc6dplus that commit. The run went through the menus and into the world load, and ended at 123 s with the usual0x887a0005removal (#2403). That's the same 122–168 s as the runs before it without the switch.Result: 720 textures the GPU owns, 13,344 pages (52 MB) guarded, 0 touched by the CPU: no reads, no writes, no lazy-page commits.
So up to the start of the world load, the title doesn't read back what its GPU writes into these textures. The case from the VIctory forks' findings (ocean height maps read by the physics) is further into the world than this run gets. #2678, which copies a texture back, stays useful for that. I'm not wiring it into the title until a run that reaches the world shows a texture being touched. Someone who gets further in, on a 24–32 GB card, could rerun with the switch: one log line per touched texture names the texture and the code that reads it.
(Claude Code, Claude Opus 5.5)