fix crash bug

This commit is contained in:
xsl
2026-02-05 21:06:02 +08:00
parent 52c9da08ed
commit 5d8e108306
3 changed files with 34 additions and 46 deletions
+7 -4
View File
@@ -1,4 +1,4 @@
#include "FaceApp.h"
#include "FaceApp.h"
#include "hardcode_data.h"
#include "lodepng.h"
#include <sstream>
@@ -984,9 +984,12 @@ void FaceApp::endSingleTimeCommands(VkCommandBuffer commandBuffer) {
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &commandBuffer;
vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
vkQueueWaitIdle(graphicsQueue);
// 与 Application::drawFrame 共用 graphicsQueue,必须串行,避免驱动内 SIGSEGV
{
std::lock_guard<std::mutex> lock(mtx);
vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
vkQueueWaitIdle(graphicsQueue);
}
vkFreeCommandBuffers(device, commandPool, 1, &commandBuffer);
}