Skip to content

Skip texture readbacks that the CPU tiler cannot land - #881

Closed
P2GR wants to merge 1 commit into
trustno1-coder:mainfrom
P2GR:contrib/skip-unlandable-texture-readbacks
Closed

P2GR wants to merge 1 commit into
trustno1-coder:mainfrom
P2GR:contrib/skip-unlandable-texture-readbacks

Conversation

@P2GR

@P2GR P2GR commented Nov 28, 2026

Copy link
Copy Markdown

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

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.
@Yoshi-233

Copy link
Copy Markdown

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.

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 added a commit to kibagami-nc/VIctory-NVIDIA that referenced this pull request Nov 28, 2026
…o1-coder#881

trustno1-coder#881 skips the copy back of a texture whose layout the tiler cannot
address, at the list, with a test on WARP. This change also returned no
target for such a texture: the same skip twice, and trustno1-coder#881 came first. So
title_texture only sets the XOR addressing now, and its test checks what
it gives: the layout addressed or not, at the right place and size.
@kibagami-nc

Copy link
Copy Markdown
Contributor

#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

Copy link
Copy Markdown
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants