fix(driver): bound transient texture upload copies within one draw or dispatch #1180

Closed
MichonGoddijn231849 wants to merge 1 commit from upstream-pr/1180 into main
MichonGoddijn231849 commented 2026-10-07 16:44:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T16:44:28Z.


What

A texture upload recorded into the open batch keeps its host staging copy and its device tiled and linear copies until the batch completes. The finished batch's objects are destroyed only when the hold ends. So a dispatch that creates a thousand bindless table textures held about three times the textures' bytes in copies, and ran out of device memory.

The copies are now kept through Recorder::KeepTransient, which counts their bytes while they live. When the live bytes exceed APS5_UPLOAD_BUDGET_MIB (default 1024), the image lookups of a build settle: the recorded work is submitted and waited for, and the finished batches' objects are destroyed at once. Builds under the budget are unchanged.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB, MinGW-w64 GCC 15.2.0.

  • GTA V PPSA04264 (01.005) runs with this change on the combined gta-v/testing branch (Performance mode, the prologue).
  • On this branch: builds, and ctest passes. Not run here: the relinker's Python tests (my local Python does not find their helper modules) and guest_gameupdate.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4775676332 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1180). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-07T16:44:28Z. --- ### What A texture upload recorded into the open batch keeps its host staging copy and its device tiled and linear copies until the batch completes. The finished batch's objects are destroyed only when the hold ends. So a dispatch that creates a thousand bindless table textures held about three times the textures' bytes in copies, and ran out of device memory. The copies are now kept through `Recorder::KeepTransient`, which counts their bytes while they live. When the live bytes exceed `APS5_UPLOAD_BUDGET_MIB` (default 1024), the image lookups of a build settle: the recorded work is submitted and waited for, and the finished batches' objects are destroyed at once. Builds under the budget are unchanged. ### Tested Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB, MinGW-w64 GCC 15.2.0. - GTA V PPSA04264 (01.005) runs with this change on the combined [`gta-v/testing`](https://github.com/MichonGoddijn231849/AnyPS5-fork/tree/gta-v/testing) branch (Performance mode, the prologue). - On this branch: builds, and `ctest` passes. Not run here: the relinker's Python tests (my local Python does not find their helper modules) and `guest_gameupdate`. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-07 19:37:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T19:37:16Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1364 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp L96-103
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp L2193-2240
#1366 core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp L96-103
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp L2193-2240
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6045403762 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1180#issuecomment-6045403762). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T19:37:16Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1364 | `core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp` [L96-103](https://github.com/boykopovar/AnyPS5/blob/9619edff7251271ad5ef2f23263ae00ccf88e35b/core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp#L96-L103)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp` [L2193-2240](https://github.com/boykopovar/AnyPS5/blob/9619edff7251271ad5ef2f23263ae00ccf88e35b/core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp#L2193-L2240) | | | | #1366 | `core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp` [L96-103](https://github.com/boykopovar/AnyPS5/blob/9619edff7251271ad5ef2f23263ae00ccf88e35b/core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp#L96-L103)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp` [L2193-2240](https://github.com/boykopovar/AnyPS5/blob/9619edff7251271ad5ef2f23263ae00ccf88e35b/core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp#L2193-L2240) | | |
oneandonlydean commented 2026-10-08 02:44:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T02:44:22Z.


Closing: #1113 bounds the same upload copies a recorder batch keeps alive, was opened first, and has a test and the out-of-memory line. If it doesn't cover what GTA V hits, please comment on #1113 with what it misses.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6051103772 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1180#issuecomment-6051103772). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T02:44:22Z. --- Closing: #1113 bounds the same upload copies a recorder batch keeps alive, was opened first, and has a test and the out-of-memory line. If it doesn't cover what GTA V hits, please comment on #1113 with what it misses.

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
boykopovar/AnyPS5!1180
No description provided.