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:
commit
9f2da178ef
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue