d3d12_xs: sync unified memory texture uploads on ExecuteCommandLists and fix Xbox One texture VA caching #121
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!121
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/121/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?
@adriaespii on GitHub · 2026-11-22 13:00 UTC · original
adriaespii:contrib/terraria-texture-sync-upload→main· +140 −2 · 3 files · 1 commits · closed without mergingSummary
This PR addresses the first-frame initialization hang on Xbox One titles such as Terraria (\d3d12_x), where Unity writes textures into CPU-visible unified memory and waits indefinitely on async texture upload completion before presenting frames.
Context & Problem
In \docs/BLOCKERS.md:
Key issues identified:
Key Changes
egister_direct_queue, \is_direct_queue, and \direct_queue\ helpers.
@adriaespii on GitHub · 2026-11-22 13:52 UTC · original
Hi @omonkeyz, thanks for the guidance!
I have rebased onto current \main\ (dropping the texture VA caching and direct queue registration parts that landed in \
d693e69) and updated the \ExecuteCommandLists\ upload pump to match all requested specifications:acing_threads_do_not_double_submit\ in \direct_queue_and_pending_tests\ testing two concurrent racing threads calling \pump_if_needed\ on a direct queue, verifying that only a single pump occurs and \has_pending\ is safely cleared.
Ready for your re-review whenever you have time. Thanks!
@omonkeyz on GitHub · 2026-11-22 17:31 UTC · original
Thanks for the rework. It now matches the requested design: an atomic pending check, gated to Xbox One, with the pump under a lock. It applies cleanly on current main, and
cargo test -p d3d12_xs --libpasses. It's approved in principle. We're holding the merge only because it changes the ExecuteCommandLists path for Xbox One titles while we bisect a GPU hang in one of them, and the next runs have to stay comparable with the earlier ones. It'll be merged once that hang is closed or shown to be unrelated. No change is needed from you. When it lands, it will include one small test fix:racing_threads_do_not_double_submitwill restore the global uploader and unregister its fake queue afterwards, so it doesn't leak state into other tests.@omonkeyz on GitHub · 2026-11-23 13:31 UTC · original
Closing as superseded: main now re-checks Xbox One textures dynamically in expose_texture_va, and syncs title writes at submit time with upload::submit_hook (write-watch, on by default). The upload.rs design this PR changes has been replaced. Thanks.
@omonkeyz on GitHub · 2026-11-22 13:23 UTC · original · requested changes
Thanks for resubmitting. The safe part of this commit (the texture VA / is_xbox_one caching fix and Direct queue registration) is already on main as
d693e69with your authorship, so please rebase onto current main and keep only the rest. The per-ExecuteCommandLists pump still needs the shape described on #118: an atomic pending check that costs nothing with no backlog, gated to Xbox One, pump() made safe from any thread under a lock (or ExecuteCommandLists only signalling the presenting/upload thread), and a test showing no double submit when two threads race. Forcing poll_mode on for Xbox One is fine together with that.Pull request closed