Merge pull request #59 from oneandonlydean/fix/retain-replaced-device

fix(agc): keep a replaced Vulkan device alive
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.
This commit is contained in:
boykopovar 2026-09-28 09:51:55 +03:00 committed by GitHub
commit 9f2da178ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -651,7 +651,11 @@ public:
std::lock_guard lock(GuestMemory::GpuMutex());
timing.Mark("gpu_mutex_wait");
if (device == nullptr || device->Window() == nullptr) {
if (device) device->PrepareForReplacement();
if (device) {
device->PrepareForReplacement();
static std::vector<std::shared_ptr<VulkanDevice>> replacedDevices;
replacedDevices.push_back(device);
}
device = std::make_shared<VulkanDevice>(&window);
}
require(device->Window() == window.context, "presentation window does not match device surface");