Skip texture readbacks that the CPU tiler cannot land #881

Closed
github-bot wants to merge 1 commit from github-bot/gh-881 into main AGit
Owner

@⁠P2GR on GitHub · 2026-11-28 08:32 UTC · original
P2GR:contrib/skip-unlandable-texture-readbacks → main · +59 −0 · 3 files · 1 commits · closed without merging

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
**@⁠P2GR** on GitHub · 2026-11-28 08:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/881) `P2GR:contrib/skip-unlandable-texture-readbacks` → `main` · +59 −0 · 3 files · 1 commits · closed without merging ## 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 ```
Check the layout once per target when closing the list, before the COPY_SOURCE transition, readback allocation and copy. Cover supported and unsupported layouts on the D3D12 software adapter.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:29:22 +00:00
Author
Owner

@⁠Yoshi-233 on GitHub · 2026-11-28 08:48 UTC · original

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.

**@⁠Yoshi-233** on GitHub · 2026-11-28 08:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/881#issuecomment-7236822612) 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.
Author
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 09:07 UTC · original

#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.

**@⁠kibagami-nc** on GitHub · 2026-11-28 09:07 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/881#issuecomment-7237034982) #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.
github-bot closed this pull request 2026-11-28 19:25:17 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-28 19:23 UTC · original

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.

**@⁠trustno1-coder** on GitHub · 2026-11-28 19:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/881#issuecomment-7244509177) 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

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

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