kernelx: textures in a GPU view read what is mapped in its CPU view (retail movie no longer green) #323
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!323
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/323/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?
@Sr-0w on GitHub · 2026-11-23 23:27 UTC · original
Sr-0w:gpu-views→main· +178 −3 · 2 files · 2 commits · closed without mergingStacked on #252; only the top commit (
b8537b2) belongs here.A retail game reserves 24 GB of GPU-visible memory read-write, then right after it 24 GB more with a graphics protection (0x801). The second is the same memory as the GPU sees it. The game maps its physical pages into the first reservation only, and places the textures the CPU fills at the same offset in the second. Its movies are decoded on the CPU into the first; the R8 Y/Cb/Cr plane textures the movie shader samples are at +0x600000000, in the second.
Under XCL the second reservation is memory of its own and nothing is ever mapped into it.
title_textureskept those textures in step with reserved memory, i.e. zeros, and a YUV frame of zeros is a green screen. The game's first movie was green from start to end.A reservation with a graphics protection made right after one of the same size without one is now recorded as that one's GPU view (
XCL_GPU_VIEWS=0turns this off). For textures in a GPU view,title_textures:Before / after: the first movie, window title cropped.
What is in it
crates/xcl/src/hle/kernelx.rs:pair_gpu_view/note_gpu_view, called where #252 reserves GPU-visible memory;gpu_view_pages, which maps a GPU view's page to its CPU view's;crates/xcl/src/hle/d3d12x/title_textures.rs:read_committedreads unmapped GPU-view pages from the CPU view;Tested
cargo test --release --workspace -- --test-threads=4: 656 passed, 0 failed, 40 ignored; no SKIPPED tests.a_gpu_view_reads_its_cpu_viewfails without theread_committedchange (checked by disabling it) and passes with it.0x1581e230000 (0x600000000 bytes, protection 0x801) is the GPU view of 0x1521e230000);Regression run
main:
this PR:
Not tested
AI use
🤖 Generated with Claude Code
@mastrr9 on GitHub · 2026-11-23 23:38 UTC · original
Heads-up (static check on
b8537b2vs currentmaindb1ddb2— not tested on Windows; no game files):21b8723):mainjust mergedkernelx::mirrorsfrom #283, which solves the same 24 GB CPU/GPU-view green-movie issue (includingmirrors::releasedonVirtualFree,physical_page_at, andgpu_view_map_gen) and now conflicts with this branch inkernelx.rs/title_textures.rs.b8537b2:GPU_VIEWSis never cleaned up inVirtualFree/VirtualFreeEx(so freeing a view — including ina_gpu_view_reads_its_cpu_view— leaves a stale alias in globalGPU_VIEWS).refresh_oncecallsgpu_view_pages(e.va, end)per texture (allocating aVecof every 64 KiB page and binary-searching each page separately) rather than checking the contiguous mapped CPU range[cpu_lo, cpu_hi)once, andread_committedchecksreadable(src, hi - lo)across a whole 64 KiB page rather than 4 KiB sub-page commits.AI use: static code check of
b8537b2vsmain(db1ddb2) with Antigravity (Gemini 4 Neon).@ivall on GitHub · 2026-11-24 00:04 UTC · original
Closing as superseded by #283 (merged in
21b8723), which solves the same CPU-view / GPU-view mapping for the green movie withkernelx::mirrors; this branch now conflicts with it. If something here is still missing on main, a small PR on top of #283 is welcome - thanks for the analysis.Pull request closed