GPU: texture read-back into a title buffer (CopyTextureRegion to a placed footprint) #1583

Closed
github-bot wants to merge 2 commits from gh-pr/1583/head into gh-pr/1583/base
Owner

@⁠Impre-visible on GitHub · 2026-11-24 19:28 UTC · original
Impre-visible:fix/texture-read-back → main · +107 −5 · 2 files · 2 commits · closed without merging

What

CopyTextureRegion from a texture to a placed footprint in a title buffer (a read-back) was skipped with the one-time warning texture to buffer copies not implemented. This implements it.

  • list.rs: when the destination is no host resource, read_back_texture copies the texture on the GPU into a read-back buffer that the list keeps, using the title's footprint at offset 0.
  • host.rs: HostList::read_back records (mapped read-back memory, title address, bytes); after the submission has run, next to the existing shadow copy-back and before the bottom-of-pipe writes, the bytes are copied into the title's buffer. upload_buffer and the new read_back_buffer share one mapped_buffer helper.
  • Refused, with a one-time warning: a destination that is no placed footprint, a buffer source, a source with no host texture, a footprint format of unknown size, a range outside the title buffer.

Measured

Linux, Wine (GE-Proton11-6) + vkd3d-proton, GTX 1660, Series X mode:

  • The world asks for its first read-back shortly before frame 2000: a 5x1 footprint of format 2, row pitch 256, 80 bytes. With this change it is served and the warning is gone.
  • No device removal in 6 runs of 4 to 9 minutes with it.
  • It does not change the title's stop described in #1323 (same stop at frames 1920 to 2063 with and without it), so it is not the cause of that one.

Not tested

  • Windows and AMD: not run (I only have this Linux/NVIDIA machine). Both cargo build --release -p victory and --features diagnostics build for x86_64-pc-windows-msvc.
  • No unit test: the path needs a host device. Depth/stencil sources and multi-plane footprints are not exercised by the title in my runs.
  • cargo clippy: not run (cross toolchain here builds but my clippy setup for the Windows target fails on a dependency's build script).

🤖 Generated with Claude Code

**@⁠Impre-visible** on GitHub · 2026-11-24 19:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/1583) `Impre-visible:fix/texture-read-back` → `main` · +107 −5 · 2 files · 2 commits · closed without merging ## What `CopyTextureRegion` from a texture to a placed footprint in a title buffer (a read-back) was skipped with the one-time warning `texture to buffer copies not implemented`. This implements it. - `list.rs`: when the destination is no host resource, `read_back_texture` copies the texture on the GPU into a read-back buffer that the list keeps, using the title's footprint at offset 0. - `host.rs`: `HostList::read_back` records (mapped read-back memory, title address, bytes); after the submission has run, next to the existing shadow copy-back and before the bottom-of-pipe writes, the bytes are copied into the title's buffer. `upload_buffer` and the new `read_back_buffer` share one `mapped_buffer` helper. - Refused, with a one-time warning: a destination that is no placed footprint, a buffer source, a source with no host texture, a footprint format of unknown size, a range outside the title buffer. ## Measured Linux, Wine (GE-Proton11-6) + vkd3d-proton, GTX 1660, Series X mode: - The world asks for its first read-back shortly before frame 2000: a 5x1 footprint of format 2, row pitch 256, 80 bytes. With this change it is served and the warning is gone. - No device removal in 6 runs of 4 to 9 minutes with it. - It does **not** change the title's stop described in #1323 (same stop at frames 1920 to 2063 with and without it), so it is not the cause of that one. ## Not tested - Windows and AMD: not run (I only have this Linux/NVIDIA machine). Both `cargo build --release -p victory` and `--features diagnostics` build for `x86_64-pc-windows-msvc`. - No unit test: the path needs a host device. Depth/stencil sources and multi-plane footprints are not exercised by the title in my runs. - `cargo clippy`: not run (cross toolchain here builds but my clippy setup for the Windows target fails on a dependency's build script). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The texture is copied on the GPU into a read-back buffer of the list's and
from there into the title's buffer once the submission has run. Before, the
copy was skipped with a one-time warning.

Measured on Linux/GTX 1660: the first read-back the world asks for is a
5x1 RGBA32F footprint (80 bytes). It does not change the title's stop at
about frame 1940-2010 (cross-queue barrier watchdog).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TsTmwWj9LVy4o3qDH52Jas
Signed-off-by: Impre-visible <[email protected]>
The read-back list and its copy sit beside main's new after/missed lists
and the fault counter; both are kept.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TsTmwWj9LVy4o3qDH52Jas
Signed-off-by: Impre-visible <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:08 +00:00
github-bot closed this pull request 2026-11-26 04:37:08 +00:00
Author
Owner

@⁠Impre-visible on GitHub · 2026-11-24 22:16 UTC · original

Merged main (70564ae) into this branch: the conflict was in host.rs, where main added the after/missed lists and the fault counter next to the read-back list and its copy; both are kept. Builds for x86_64-pc-windows-msvc with and without --features diagnostics. Not re-run in the title after the merge.

🤖 Generated with Claude Code

**@⁠Impre-visible** on GitHub · 2026-11-24 22:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/1583#issuecomment-7146030788) Merged `main` (70564ae) into this branch: the conflict was in `host.rs`, where `main` added the `after`/`missed` lists and the fault counter next to the read-back list and its copy; both are kept. Builds for `x86_64-pc-windows-msvc` with and without `--features diagnostics`. Not re-run in the title after the merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:42 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #67. the same patch (only context moved); main still warns 'not implemented' (list.rs:511), and #67, force-pushed to build on main, implements the same read-back with a GPU test.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/1583#issuecomment-7148798510) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #67. the same patch (only context moved); main still warns 'not implemented' (list.rs:511), and #67, force-pushed to build on main, implements the same read-back with a GPU test. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

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/Marvisak--VIctory!1583
No description provided.