[pr-fix][rendering][memory] Refresh placed textures after streamed writes through an alias #433

Open
holoslicer wants to merge 1 commit from holoslicer/aliased-texture-writes into main AGit
Contributor

Offline D3D12 reproduction and fix. Gameplay validation is pending. Refs #396 and #311.

Contributor role (optional)

Not requested.

What it changes

DirectStorage can finish writing through one virtual address while a bindless SRV samples another mapping of the same physical page. Main marks the buffer-watch bits but only passes the destination address to the placed-texture queue. Report the written byte range at each current mapping. Physical destinations already enumerate their mappings.

How it was tested

Tested 083918931e against f3840d73d3 on Windows 11 build 26300.9818, RTX 3090 24 GB, driver 617.42, Rust 1.98.1. The test uses generated tiled RGBA8 textures.

  1. Apply only the regression test to main for the control. Run cargo test --locked -p darner-gpu --lib streamed_texture_written_through_an_alias_reaches_a_full_queue -- --nocapture --test-threads=1 on both revisions.
  2. Start with two resident textures and 8,192 other pending texture uploads. Write through another mapping at a 4 KiB offset. Deliver 64 completion notices before polling, allow one upload, and read back all pixels.
  3. Rebind the same write address to the second physical page and repeat. Check the previous texture and the unwritten neighbour. Cross DARNER_LIGHT_REFRESH=0/1 with DARNER_PRELUDE_UPLOADS=0/1.
First eligible upload Main Fix
Correct pixels after the first write 0/1,024 1,024/1,024
Correct pixels after the remapped write 0/1,024 1,024/1,024
Passing fresh processes 0/4 12/12

The fix added just the affected slot to the queue in each pass. Both passes finished with the original 8,192 slots pending. The existing late-completion, guard and remap-cursor controls also passed.

No switch or budget defaults changed. This reproduces a specific missed invalidation. In-game frame time, visible flicker, full-VRAM behaviour and other GPUs remain unmeasured. Shader wave size is outside this change.

The asset policy and both workspace Clippy gates passed with warnings denied. The full serial workspace gate failed. The CLI child-exit and shader depth-output checks also failed on clean main. The nested-worker and reservation-split failures were recorded on the same main revision and passed in all eight isolated runs on the fix. Three loopback checks and one temporary-save hard-link check passed when rerun with normal Windows permissions.

Checklist

  • Gameplay is pending. Validation for this change was limited to the standalone D3D12 test.
  • One change based on official main.
  • The diff follows the asset policy.
  • Dependencies recorded. None.

Checked for overlap

  • Searched open and closed issues and PRs, including open PRs touching watch.rs.
  • Related PRs are #50 (mip refresh), #150 (write-watch tests), #219 (view guards) and #321 (free notifications). None handles this stream-completion path.
Offline D3D12 reproduction and fix. Gameplay validation is pending. Refs #396 and #311. ## Contributor role (optional) Not requested. ## What it changes DirectStorage can finish writing through one virtual address while a bindless SRV samples another mapping of the same physical page. Main marks the buffer-watch bits but only passes the destination address to the placed-texture queue. Report the written byte range at each current mapping. Physical destinations already enumerate their mappings. ## How it was tested Tested `083918931e` against `f3840d73d3` on Windows 11 build 26300.9818, RTX 3090 24 GB, driver 617.42, Rust 1.98.1. The test uses generated tiled RGBA8 textures. 1. Apply only the regression test to main for the control. Run `cargo test --locked -p darner-gpu --lib streamed_texture_written_through_an_alias_reaches_a_full_queue -- --nocapture --test-threads=1` on both revisions. 2. Start with two resident textures and 8,192 other pending texture uploads. Write through another mapping at a 4 KiB offset. Deliver 64 completion notices before polling, allow one upload, and read back all pixels. 3. Rebind the same write address to the second physical page and repeat. Check the previous texture and the unwritten neighbour. Cross `DARNER_LIGHT_REFRESH=0/1` with `DARNER_PRELUDE_UPLOADS=0/1`. | First eligible upload | Main | Fix | |---|---:|---:| | Correct pixels after the first write | 0/1,024 | 1,024/1,024 | | Correct pixels after the remapped write | 0/1,024 | 1,024/1,024 | | Passing fresh processes | 0/4 | 12/12 | The fix added just the affected slot to the queue in each pass. Both passes finished with the original 8,192 slots pending. The existing late-completion, guard and remap-cursor controls also passed. No switch or budget defaults changed. This reproduces a specific missed invalidation. In-game frame time, visible flicker, full-VRAM behaviour and other GPUs remain unmeasured. Shader wave size is outside this change. The asset policy and both workspace Clippy gates passed with warnings denied. The full serial workspace gate failed. The CLI child-exit and shader depth-output checks also failed on clean main. The nested-worker and reservation-split failures were recorded on the same main revision and passed in all eight isolated runs on the fix. Three loopback checks and one temporary-save hard-link check passed when rerun with normal Windows permissions. ## Checklist - [ ] Gameplay is pending. Validation for this change was limited to the standalone D3D12 test. - [x] One change based on official main. - [x] The diff follows the asset policy. - [x] Dependencies recorded. None. ## Checked for overlap - [x] Searched open and closed issues and PRs, including open PRs touching `watch.rs`. - Related PRs are #50 (mip refresh), #150 (write-watch tests), #219 (view guards) and #321 (free notifications). None handles this stream-completion path.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/433/head:holoslicer/aliased-texture-writes'
git switch 'holoslicer/aliased-texture-writes'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'holoslicer/aliased-texture-writes'
git switch 'holoslicer/aliased-texture-writes'
git rebase 'main'
git switch 'main'
git merge --ff-only 'holoslicer/aliased-texture-writes'
git switch 'holoslicer/aliased-texture-writes'
git rebase 'main'
git switch 'main'
git merge --no-ff 'holoslicer/aliased-texture-writes'
git switch 'main'
git merge --squash 'holoslicer/aliased-texture-writes'
git switch 'main'
git merge --ff-only 'holoslicer/aliased-texture-writes'
git switch 'main'
git merge 'holoslicer/aliased-texture-writes'
git push origin 'main'
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!433
No description provided.