[pr-fix][rendering] Preserve list texture updates after a late upload-ahead completion #104

Manually merged
TrustNo1 merged 1 commit from tyr0nsur/Darner:codex/preserve-pending-ahead-texture-upload into main 2026-12-03 20:55:07 +00:00
Contributor

Contributor role (optional)

  • Fluxer ID: 1576997513825615872

What it changes

The COPY worker can publish completion after an ordinary draw list has timed out in listed() and taken over its staging buffer. On current main, the worker then clears a newer pending refresh. The next list skips the upload and the GPU keeps the previous texture bytes.

Set the uploaded and clean flags and remember the hash only while the staging buffer is still one-shot. Check this under the refresh lock so completion and a newer refresh cannot clear each other's work. The worker still publishes its fence result, wakes waiters, and runs its descriptor callbacks.

How it was tested

  • Tested revisions: 1a5286a78daa with the regression test and cc3a00d15092 based on bd0de0cec244 with the fix, on Windows 11 build 26300, RTX 4060 8 GB, driver 621.40, Rust 1.98.1.
  • With DARNER_ADAPTER=RTX 4060, DARNER_UPLOAD_AHEAD=1, and DARNER_PRELUDE_UPLOADS=1, ran cargo --config 'profile.test.debug=0' test --locked -p darner-gpu --lib texture::ahead::tests::late_completion_keeps_a_newer_list_refresh -- --exact --ignored --test-threads=1 --nocapture. The test uses a real COPY fence and delays CPU completion. The BC7 mip read back as 0x1b on main (expected 0xb7). On the fix, all 65,536 bytes matched in three runs of the committed revision.
  • All 1,734 active GPU-library tests passed in separate processes on cc3a00d15092, with 81 ignored. Ran cargo --config 'profile.test.debug=0' test --locked -p darner-gpu --lib with these arguments in order:
    • -- --test-threads=1 --skip watch::: 1,646 passed.
    • watch:: -- --test-threads=1 --skip watch::tests::ask_once_by_res_splits_reservations_without_refusals: 87 passed.
    • watch::tests::ask_once_by_res_splits_reservations_without_refusals -- --exact --test-threads=1: 1 passed.
  • The grouped watch run failed at ask_once_by_res_splits_reservations_without_refusals with a journal entry for the plain allocation. The same test also failed in a combined GPU-library run on unmodified 1a5286a78daa. A separate grouped watch run on unmodified bd0de0cec244 passed 88/88.
  • cargo clippy --workspace --all-targets --locked -- -D warnings and cargo clippy --workspace --all-targets --all-features --locked -- -D warnings passed. cargo run --locked --quiet --package xtask -- policy checked 553 files and the staged check passed.
  • Coverage gaps: full workspace tests, gameplay, frequency of the timeout in play, and simultaneous writes across D3D12 queues. The synthetic case releases the CPU completion only after the COPY fence has signaled.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #50 changes the same upload bookkeeping to use a mip mask. The D3D12 comparison in #50 shows that the old mip stays stale after a later write to a different mip. This PR applies the bookkeeping fix to current main. #93 covers waits on the single host relay queue. If #50 is rebased onto this fix, use its uploads.copied() inside the guard in finish(), alongside the held hash update.
## Contributor role (optional) - Fluxer ID: 1576997513825615872 ## What it changes The COPY worker can publish completion after an ordinary draw list has timed out in `listed()` and taken over its staging buffer. On current `main`, the worker then clears a newer pending refresh. The next list skips the upload and the GPU keeps the previous texture bytes. Set the uploaded and clean flags and remember the hash only while the staging buffer is still one-shot. Check this under the refresh lock so completion and a newer refresh cannot clear each other's work. The worker still publishes its fence result, wakes waiters, and runs its descriptor callbacks. ## How it was tested - Tested revisions: `1a5286a78daa` with the regression test and `cc3a00d15092` based on `bd0de0cec244` with the fix, on Windows 11 build 26300, RTX 4060 8 GB, driver 621.40, Rust 1.98.1. - With `DARNER_ADAPTER=RTX 4060`, `DARNER_UPLOAD_AHEAD=1`, and `DARNER_PRELUDE_UPLOADS=1`, ran `cargo --config 'profile.test.debug=0' test --locked -p darner-gpu --lib texture::ahead::tests::late_completion_keeps_a_newer_list_refresh -- --exact --ignored --test-threads=1 --nocapture`. The test uses a real COPY fence and delays CPU completion. The BC7 mip read back as `0x1b` on `main` (expected `0xb7`). On the fix, all 65,536 bytes matched in three runs of the committed revision. - All 1,734 active GPU-library tests passed in separate processes on `cc3a00d15092`, with 81 ignored. Ran `cargo --config 'profile.test.debug=0' test --locked -p darner-gpu --lib` with these arguments in order: - `-- --test-threads=1 --skip watch::`: 1,646 passed. - `watch:: -- --test-threads=1 --skip watch::tests::ask_once_by_res_splits_reservations_without_refusals`: 87 passed. - `watch::tests::ask_once_by_res_splits_reservations_without_refusals -- --exact --test-threads=1`: 1 passed. - The grouped watch run failed at `ask_once_by_res_splits_reservations_without_refusals` with a journal entry for the plain allocation. The same test also failed in a combined GPU-library run on unmodified `1a5286a78daa`. A separate grouped watch run on unmodified `bd0de0cec244` passed 88/88. - `cargo clippy --workspace --all-targets --locked -- -D warnings` and `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` passed. `cargo run --locked --quiet --package xtask -- policy` checked 553 files and the staged check passed. - Coverage gaps: full workspace tests, gameplay, frequency of the timeout in play, and simultaneous writes across D3D12 queues. The synthetic case releases the CPU completion only after the COPY fence has signaled. ## Checklist - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #50 changes the same upload bookkeeping to use a mip mask. The [D3D12 comparison in #50](https://git.gtahub.st/TrustNo1/Darner/pulls/50#issuecomment-850439) shows that the old mip stays stale after a later write to a different mip. This PR applies the bookkeeping fix to current `main`. #93 covers waits on the single host relay queue. If #50 is rebased onto this fix, use its `uploads.copied()` inside the guard in `finish()`, alongside the held hash update.
TrustNo1 manually merged commit 28070a2524 into main 2026-12-03 20:55:07 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!104
No description provided.