Title textures: uploads start from the state the title's transitions left (#104 item 2) #135
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!135
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/135/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?
@tiagonleal on GitHub · 2026-11-23 14:45 UTC · original
tiagonleal:fix/title-texture-states→main· +354 −18 · 6 files · 1 commits · merged 2026-11-23 21:08 UTC#104 item 2, the state part ("a PR that tracks the title's transitions for kept-in-step textures would be welcome").
A texture kept in step with title memory (
title_textures) was uploaded again with barriers from and back to the state it was created in. Once the title had moved it –COMMON → PIXEL_SHADER_RESOURCE, or one mip toCOPY_SOURCE– the upload's "before" state was wrong. The D3D12 debug layer reports exactly that (from the new test):Change
resource_barrier_x(after the console → PC state masking) and in console lists' barrier replay atClose(which re-records the whole list, so its notes start over there).ExecuteCommandLists(after the PC submit, on the mapped PC lists) andKickoffXapply them to the texture's state in submission order – each time a closed list runs.Reset, create and release forget a list's notes.texture::record_upload_states(one barrier for all subresources when uniform, as before; else one per subresource that changes).upload_batchitems carry those states;record_uploadkeeps its signature.title_textures::any()first, then a lookup), so lists without them cost one atomic load perResourceBarriercall.Implicit promotion / decay needs nothing extra: a texture promoted to a read state decays back to COMMON at the end of the
ExecuteCommandListscall, which is the state still noted; a texture promoted toCOPY_DESTby a copy is GPU-written and is not uploaded again (note_gpu_write).Not in this PR: the queue sync half of #104 item 2
The upload still runs on XCL's queue without a GPU wait for title work that may still sample the texture. Fixing that by making the upload queue wait for the title's queues would make the CPU's existing wait on the upload wait for the title's frames in flight too – a stall on every refresh with a dirty texture while a game streams. Doing it without the stall means having the title's queue GPU-wait on the upload fence, with the staging buffers kept alive until it passes. That is a separate change, and it should be measured on a game, which I can't run here.
Tests
title_textures::tests::transitions_per_subresource_and_back_to_one_state– the state per subresource, collapsing back to one.title_textures::tests::transitions_apply_when_their_list_is_submitted– notes count only once submitted, in submission order, again when a closed list runs again, not afterReset; other resources are not noted. The test entry is GPU-written, so a concurrentrefreshnever touches its fake pointer.tests/texture_states.rs(its own process: the debug layer must be on before the first device) – a 4-mip texture in shader-resource states with mip 1 moved toCOPY_SOURCE: an upload with each subresource's state gives 0 debug-layer errors and leaves them in their states; with one state for all of them (what uploads did before) the debug layer reports the mismatch above, so the check is a real one. It skips without the debug layer (Graphics Tools) or a GPU.Run: NVIDIA GeForce RTX 5070 Ti, driver 32.0.16.1742, Windows 11 Pro 26300, rustc 1.99.1.
cargo test --workspace --no-fail-fast -- --test-threads=4onmain95bda11: 551 passed, 0 failed, 37 ignored; 2SKIPPED …: no wave64.Not run: a game. The hooks only add notes and apply them; uploads of textures the title never transitions get the same barriers as before.
AI-assisted.
🤖 Generated with Claude Code
@ivall on GitHub · 2026-11-23 21:08 UTC · original
Merged (main
6da33fa). Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on maineaa36b6:cargo build --workspace && cargo test --workspace -- --test-threads=4- 582 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed too; and the retail game still reaches its first menu (646 frames in 30 s, no device removal).@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-23 14:45 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.