fix(libSceAgcDriver): destroy host imports of a replaced Vulkan device #284

Merged
SP4C3B4R-8 merged 1 commit from upstream-pr/284 into main 2026-10-04 02:13:54 +00:00
SP4C3B4R-8 commented 2026-10-01 21:57:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SP4C3B4R-8 on 2026-10-01T21:57:08Z.


What

When the headless Vulkan device is replaced by the windowed one, the host import registry was cleared without destroying the imported buffers and memory. The replaced device is kept alive in Driver::replacedDevices, so all imported pinned host memory stayed allocated, and the new device failed with VK_ERROR_OUT_OF_DEVICE_MEMORY when importing the same ranges again (several GiB in a large title). The registry now keeps the destroy functions of its device and frees the imports on replacement.

Tested

Windows 11, MinGW-w64 GCC 15.2.0 (winlibs, ucrt posix seh). Full build and ctest: 95/95 passed on this branch alone. Also checked with a retail title.

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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude). I reviewed and take responsibility for every line.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4710109734 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/284). Originally posted by [SP4C3B4R-8](https://github.com/SP4C3B4R-8) on 2026-10-01T21:57:08Z. --- ### What When the headless Vulkan device is replaced by the windowed one, the host import registry was cleared without destroying the imported buffers and memory. The replaced device is kept alive in `Driver::replacedDevices`, so all imported pinned host memory stayed allocated, and the new device failed with VK_ERROR_OUT_OF_DEVICE_MEMORY when importing the same ranges again (several GiB in a large title). The registry now keeps the destroy functions of its device and frees the imports on replacement. ### Tested Windows 11, MinGW-w64 GCC 15.2.0 (winlibs, ucrt posix seh). Full build and `ctest`: 95/95 passed on this branch alone. Also checked with a retail title. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [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 (Claude). I reviewed and take responsibility for every line. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-02 00:48:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-02T00:48:27Z.


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
#290 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L365, L367-368, L370-371
#291 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L365, L367-368, L370-371
#426 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L365, L367-368, L370-371
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5943479873 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/284#issuecomment-5943479873). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-02T00:48:27Z. --- <!-- 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 | |---|---|---|---| | #290 | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` [L365](https://github.com/boykopovar/AnyPS5/blob/e7eabe5048b1e668cd7d9b5f43309af8ae3e1e47/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L365), [L367-368](https://github.com/boykopovar/AnyPS5/blob/e7eabe5048b1e668cd7d9b5f43309af8ae3e1e47/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L367-L368), [L370-371](https://github.com/boykopovar/AnyPS5/blob/e7eabe5048b1e668cd7d9b5f43309af8ae3e1e47/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L370-L371) | | | | #291 | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` [L365](https://github.com/boykopovar/AnyPS5/blob/e7eabe5048b1e668cd7d9b5f43309af8ae3e1e47/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L365), [L367-368](https://github.com/boykopovar/AnyPS5/blob/e7eabe5048b1e668cd7d9b5f43309af8ae3e1e47/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L367-L368), [L370-371](https://github.com/boykopovar/AnyPS5/blob/e7eabe5048b1e668cd7d9b5f43309af8ae3e1e47/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L370-L371) | | | | #426 | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` [L365](https://github.com/boykopovar/AnyPS5/blob/e7eabe5048b1e668cd7d9b5f43309af8ae3e1e47/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L365), [L367-368](https://github.com/boykopovar/AnyPS5/blob/e7eabe5048b1e668cd7d9b5f43309af8ae3e1e47/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L367-L368), [L370-371](https://github.com/boykopovar/AnyPS5/blob/e7eabe5048b1e668cd7d9b5f43309af8ae3e1e47/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L370-L371) | | |
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!284
No description provided.