Guard FrameGen teardown and resize on idle failure

This commit is contained in:
LunaDL committed 2026-11-27 12:41:06 -04:00
1 parent 734a2679ef
commit f337d284e8
1 file changed
+11 -2
+11 -2
View File
@@ -169,6 +169,13 @@ bool FrameGen::onResize(VkExtent2D extent, VkFormat , bool force) {
if (!force && ready_ && extent.width == extent_.width && extent.height == extent_.height) return true;
if (ready_) {
const VkResult idleResult = dd_->DeviceWaitIdle(device_);
if (idleResult != VK_SUCCESS) {
DDFG_LOGE("framegen resize: DeviceWaitIdle failed (%d); keeping existing images", (int)idleResult);
return false;
}
}
++imageGeneration_;
for (auto& i : pyrA_) destroyImage(i); pyrA_.clear();
for (auto& i : pyrB_) destroyImage(i); pyrB_.clear();
@@ -230,8 +237,10 @@ void FrameGen::initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout t
void FrameGen::destroy() {
if (!device_) return;
const VkResult idleResult = dd_->DeviceWaitIdle(device_);
if (idleResult != VK_SUCCESS)
DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); continuing teardown", (int)idleResult);
if (idleResult != VK_SUCCESS) {
DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); preserving resources for safe retry", (int)idleResult);
return;
}
destroyScratchResources();
for (auto& i : pyrA_) destroyImage(i); pyrA_.clear();
for (auto& i : pyrB_) destroyImage(i); pyrB_.clear();