fix(agc): keep a replaced Vulkan device alive #59

Merged
oneandonlydean merged 1 commit from upstream-pr/59 into main 2026-09-28 06:51:55 +00:00
oneandonlydean commented 2026-09-28 03:47:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-28T03:47:40Z.


What

The driver starts with a headless Vulkan device and replaces it with a windowed one at the first flip. The old device was destroyed as soon as the replacement was made. At that point, objects created from it (102 of them in a retail title, mostly device memory) were still referenced by caches. Destroying a device with live child objects is invalid (validation reports VUID-vkDestroyDevice-device-05137), and the title later crashed inside the NVIDIA driver.

How

In the presenter path, after PrepareForReplacement() (which flushes cached textures, publishes shadows and waits for idle), the old device is kept in a function-local static list instead of being released. Its child objects stay valid for as long as anything still refers to them. The cost is one idle device for the life of the process; the replacement happens once, at the first flip.

Testing

No automated test: the replacement only happens when a window is attached at the first flip, and agc_driver_flip already hangs on main. All other CTest tests pass (agc_driver and agc_driver_pm4 fail as on main).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4659000946 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/59). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-09-28T03:47:40Z. --- ### What The driver starts with a headless Vulkan device and replaces it with a windowed one at the first flip. The old device was destroyed as soon as the replacement was made. At that point, objects created from it (102 of them in a retail title, mostly device memory) were still referenced by caches. Destroying a device with live child objects is invalid (validation reports `VUID-vkDestroyDevice-device-05137`), and the title later crashed inside the NVIDIA driver. ### How In the presenter path, after `PrepareForReplacement()` (which flushes cached textures, publishes shadows and waits for idle), the old device is kept in a function-local static list instead of being released. Its child objects stay valid for as long as anything still refers to them. The cost is one idle device for the life of the process; the replacement happens once, at the first flip. ### Testing No automated test: the replacement only happens when a window is attached at the first flip, and `agc_driver_flip` already hangs on `main`. All other CTest tests pass (`agc_driver` and `agc_driver_pm4` fail as on `main`).
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!59
No description provided.