Skip texture readbacks that the CPU tiler cannot land #881

Closed
P2GR wants to merge 1 commit from upstream-pr/881 into main
P2GR commented 2026-11-28 08:32:09 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by P2GR on 2026-11-28T08:32:09Z.


Change

Skip texture readbacks when the destination layout cannot be tiled. Check after the command list deduplicates texture writes and before the COPY_SOURCE transition. This avoids allocating a readback buffer, recording the GPU copy and reading destination memory before the tiler rejects the layout. The first skip still logs the swizzle and sample count.

RTX 2080 Ti context

An earlier RTX 2080 Ti run logged a texture copy that failed with Unsupported during tiling. A run with our local early check logged a skip for swizzle 27. The heavier prologue sample spent a median 8.8 ms per frame in the overall copy-back stage at 1280×720 rendered to 1920×1080 with DLSS Quality and frame generation off. That timing covers the whole stage. A matched hardware FPS comparison for this patch is pending.

Validation

  • On verified Microsoft D3D12 WARP, synthetic 256×256 R32_FLOAT textures exercise repeated write notifications and command-list closure. The unpatched code records work for swizzle 27. This patch records no readback work for it and still records the supported 4 KiB layout.
  • The existing readback ticket test, the release build check for victory-gpu, and the repository asset-policy check passed.
$env:VICTORY_D3D12_WARP = '1'
$env:VICTORY_TEXTURE_BACK = '256x256f41'
cargo test --locked -p victory-gpu --lib --features diagnostics resource::tests::only_addressable_textures_record_readbacks -- --exact --ignored
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5538337074 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/881). Originally posted by [P2GR](https://github.com/P2GR) on 2026-11-28T08:32:09Z. --- ## Change Skip texture readbacks when the destination layout cannot be tiled. Check after the command list deduplicates texture writes and before the `COPY_SOURCE` transition. This avoids allocating a readback buffer, recording the GPU copy and reading destination memory before the tiler rejects the layout. The first skip still logs the swizzle and sample count. ## RTX 2080 Ti context An earlier RTX 2080 Ti run logged a texture copy that failed with `Unsupported` during tiling. A run with our local early check logged a skip for swizzle 27. The heavier prologue sample spent a median 8.8 ms per frame in the overall copy-back stage at 1280×720 rendered to 1920×1080 with DLSS Quality and frame generation off. That timing covers the whole stage. A matched hardware FPS comparison for this patch is pending. ## Validation - On verified Microsoft D3D12 WARP, synthetic 256×256 R32_FLOAT textures exercise repeated write notifications and command-list closure. The unpatched code records work for swizzle 27. This patch records no readback work for it and still records the supported 4 KiB layout. - The existing readback ticket test, the release build check for `victory-gpu`, and the repository asset-policy check passed. ```powershell $env:VICTORY_D3D12_WARP = '1' $env:VICTORY_TEXTURE_BACK = '256x256f41' cargo test --locked -p victory-gpu --lib --features diagnostics resource::tests::only_addressable_textures_record_readbacks -- --exact --ignored ```
Yoshi-233 commented 2026-11-28 08:48:21 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yoshi-233 on 2026-11-28T08:48:21Z.


I checked this PR together with #892 on Windows using Microsoft's D3D12 WARP adapter. I ran resource::tests::only_addressable_textures_record_readbacks with VICTORY_D3D12_WARP=1 and VICTORY_TEXTURE_BACK=256x256f41.

  • Your head 05bb2d3 alone: the ignored WARP test passes, including the unsupported swizzle-27 case.
  • Combined with a231183 from #892: the only merge conflict was where both heads inserted a test into resource.rs. I kept both test bodies. The original WARP assertion then fails with swizzle 27: left=true, right=false. The newly supported aligned R32_FLOAT resource now correctly records GPU work.
  • Keeping the same command-list test, I explicitly checked the 64 KiB alignment and used three expectations: SW_4KB_S → record, SW_64KB_R_X → record, SW_64KB_S_X → skip. All three passed on WARP. #892’s separate unit test also passed with its aligned and 256-byte-offset R32 cases.

If both patches land, the unsupported negative control can use SW_64KB_S_X. The repeated write notifications and list closure still exercise the original purpose of this test. The 4070 Ti SUPER surface recorded in #880 is one example that transitions from unsupported to supported.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7236822612 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/881#issuecomment-7236822612). Originally posted by [Yoshi-233](https://github.com/Yoshi-233) on 2026-11-28T08:48:21Z. --- I checked this PR together with #892 on Windows using Microsoft's D3D12 WARP adapter. I ran `resource::tests::only_addressable_textures_record_readbacks` with `VICTORY_D3D12_WARP=1` and `VICTORY_TEXTURE_BACK=256x256f41`. * Your head `05bb2d3` alone: the ignored WARP test passes, including the unsupported swizzle-27 case. * Combined with `a231183` from #892: the only merge conflict was where both heads inserted a test into `resource.rs`. I kept both test bodies. The original WARP assertion then fails with `swizzle 27: left=true, right=false`. The newly supported aligned R32_FLOAT resource now correctly records GPU work. * Keeping the same command-list test, I explicitly checked the 64 KiB alignment and used three expectations: `SW_4KB_S → record`, `SW_64KB_R_X → record`, `SW_64KB_S_X → skip`. All three passed on WARP. #892’s separate unit test also passed with its aligned and 256-byte-offset R32 cases. If both patches land, the unsupported negative control can use `SW_64KB_S_X`. The repeated write notifications and list closure still exercise the original purpose of this test. The 4070 Ti SUPER surface recorded in #880 is one example that transitions from unsupported to supported.
kibagami-nc commented 2026-11-28 09:07:53 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T09:07:53Z.


#892 skipped the same copies in title_texture, so the two did the same thing twice, and yours came first. I took that part out of #892 (7f6e2aa). It now only adds the addressing, for a 256x256 R32_FLOAT plane in SW_64KB_R_X at a 64 KiB boundary. Skipping whatever still cannot be addressed is this pull request's.

One thing for when both land, as Yoshi-233 found: the aligned SW_64KB_R_X texture is copied back then. The unsupported case of only_addressable_textures_record_readbacks would then be SW_64KB_S_X, and the test would still go through the repeated writes and the list's close.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7237034982 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/881#issuecomment-7237034982). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T09:07:53Z. --- #892 skipped the same copies in `title_texture`, so the two did the same thing twice, and yours came first. I took that part out of #892 (`7f6e2aa`). It now only adds the addressing, for a 256x256 `R32_FLOAT` plane in `SW_64KB_R_X` at a 64 KiB boundary. Skipping whatever still cannot be addressed is this pull request's. One thing for when both land, as Yoshi-233 found: the aligned `SW_64KB_R_X` texture is copied back then. The unsupported case of `only_addressable_textures_record_readbacks` would then be `SW_64KB_S_X`, and the test would still go through the repeated writes and the list's close.
trustno1-coder commented 2026-11-28 19:23:32 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T19:23:32Z.


Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7244509177 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/881#issuecomment-7244509177). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T19:23:32Z. --- Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
trustno1-coder/VIctory-NVIDIA!881
No description provided.