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

Closed
Impre-visible wants to merge 2 commits from upstream-pr/1583 into main
Impre-visible commented 2026-11-24 19:28:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Impre-visible on 2026-11-24T19:28:17Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6589707630 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1583). Originally posted by [Impre-visible](https://github.com/Impre-visible) on 2026-11-24T19:28:17Z. --- ## 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)
Impre-visible commented 2026-11-24 23:05:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Impre-visible on 2026-11-24T22:16:43Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146030788 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1583#issuecomment-7146030788). Originally posted by [Impre-visible](https://github.com/Impre-visible) on 2026-11-24T22:16:43Z. --- 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)
upstream-sync closed this pull request 2026-11-25 01:06:53 +00:00
Marvisak commented 2026-11-25 01:08:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:42:50Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148798510 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1583#issuecomment-7148798510). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:42:50Z. --- 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

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