texture: keep pending list refreshes when an upload ahead finishes (D3D12-AHEAD-KEEP-PENDING-REFRESH) #3432
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!3432
Loading…
Reference in a new issue
No description provided.
Delete branch "oreofr/ahead-keep-pending-refresh"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as:
D3D12-AHEAD-KEEP-PENDING-REFRESH(https://git.leonida.now/leonida/mandy/issues/3312#issuecomment-25239)What and why
d3d12/crates/leonida-gpu/src/texture/ahead.rsfinish(): when a copy-queue upload (LEONIDA_UPLOAD_AHEAD=1) completes afterlisted()stopped waiting (1 s), a draw list may already have taken over the staging buffer (onceset to false inupload_from) and refreshed it from newer title memory. The late completion still marked the staging bufferuploadedand clean (dirty = false) and noted the old hash as held. As a result, the newer refresh was never uploaded and the texture kept its old texels.finish()now marks it clean and notes the hash only while it is still the one-shot upload (oncetrue). It checks under the staging'slastlock, which a list's refresh also takes. The completion state (copy.ahead = DONE,BYTES) is unchanged.The PR adds a GPU test,
texture::ahead::tests::late_completion_keeps_a_newer_list_refresh. It is ignored by default because it needs a D3D12 device and its own process with prelude uploads on, which is Mandy's default (LEONIDA_PRELUDE_UPLOADnot 0).resource::resource_releasebecomespub(crate)so the test can release its texture.Ported from Darner (TrustNo1/Darner, GPL-3.0-or-later) commit 28070a252, PR #104 by tyr0nsur. Changes from Darner: crate and switch names; the test uses
texture::prelude_upload()(Mandy's default-on switch) instead of Darner'sprelude_uploads(); it useswindows_sysforVirtualAllocand drops Darner'swatch::one_view_test()lock, which Mandy does not have.Tested
Red/green,
cargo test --locked -p leonida-gpu --lib late_completion_keeps_a_newer_list_refresh -- --ignored:finish()as on main863694e28):panicked at crates\leonida-gpu\src\texture\ahead.rs:554:9: first BC7 byte was 0x1b, expected 0xb7,test result: FAILED. 0 passed; 1 failedtest texture::ahead::tests::late_completion_keeps_a_newer_list_refresh ... ok, 3 of 3 runsAlso run, all from
d3d12/:cargo test --locked -p leonida-gpu: 730 passed, 0 failed, 60 ignored.cargo clippy --locked -p leonida-gpu --all-targets -- -D warnings: clean.cargo build --locked --profile diag -p leonida --features diagnostics,dlss,mimalloc: OK.python -I scripts/check_no_game_data.pyon both changed files: clean.There is no in-game run yet.
LEONIDA_UPLOAD_AHEADstays off by default, so the default path does not change.GPUs tested: NVIDIA GeForce RTX 4070 Laptop GPU, driver 621.40, Windows 11 Pro (unit/GPU test only, no game run)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
79bc6f669into #3432 (tree tested by local CI) 837605e7b8Merged by OreoFR (agent) at MoonEyes' request: his judge accepted it after reading the code, with no blocking point. The concurrency with
finishholds; at worst a send happens twice. He asked for the local CI only, because the change acts only whenLEONIDA_UPLOAD_AHEADis on, and that is off by default. The judge's two minor comments are addressed in65d0700b8.Local CI (normal mode) on head
65d0700b8merged into main79bc6f669: PASS.make_game.py --help.leonida,leonida-gpuandleonida-hle, 163 s.-D warnings, 53 s.The forge refused the merge while the head was behind main. So
main(79bc6f669) was merged into the head as837605e7b, with the same tree the CI tested. Merged asa700d029e.