From 584601624746aada44b0dc0c8d75406ca20e6790 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 3 Dec 2017 20:30:21 -0800 Subject: [PATCH] Vulkan: Allow shutdown with init commands. On startup, when immediately shutting down, there will be init commands from creating the backbuffers. Rather than fight this, just free them. This fixes hangs when locking/unlocking Android. --- ext/native/thin3d/VulkanRenderManager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/native/thin3d/VulkanRenderManager.cpp b/ext/native/thin3d/VulkanRenderManager.cpp index 9f310b2b4e..4405e8bd12 100644 --- a/ext/native/thin3d/VulkanRenderManager.cpp +++ b/ext/native/thin3d/VulkanRenderManager.cpp @@ -225,8 +225,12 @@ void VulkanRenderManager::StopThread() { // when we restart... for (int i = 0; i < vulkan_->GetInflightFrames(); i++) { auto &frameData = frameData_[i]; - if (frameData.readyForRun || frameData.hasInitCommands || frameData.steps.size() != 0) { - Crash(); + _assert_(!frameData.readyForRun); + _assert_(frameData.steps.empty()); + if (frameData.hasInitCommands) { + // Clear 'em out. This can happen on restart sometimes. + vkEndCommandBuffer(frameData.initCmd); + frameData.hasInitCommands = false; } frameData.readyForRun = false; for (size_t i = 0; i < frameData.steps.size(); i++) {