整理卡死的问题

This commit is contained in:
xsl
2026-04-21 00:03:27 +08:00
parent 5d8e108306
commit 7ab4274e4f
9 changed files with 31 additions and 42 deletions
+6 -11
View File
@@ -683,10 +683,6 @@ void FaceApp::update_descriptor_set(vector<Texture>& texs, vector<VkDescriptorSe
void FaceApp::render(VkCommandBuffer commandBuffer, long long frameTime)
{
std::unique_lock<std::mutex> lock(mtx);
std::unique_lock<std::mutex> lock_point(mtx_point);
std::unique_lock<std::mutex> lock_changeMotion(changeMotionMtx);
//Application::render(commandBuffer);
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout_bg, 0, 1, &m_descriptor_set_bg, 0, NULL);
@@ -984,12 +980,8 @@ void FaceApp::endSingleTimeCommands(VkCommandBuffer commandBuffer) {
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &commandBuffer;
// 与 Application::drawFrame 共用 graphicsQueue,必须串行,避免驱动内 SIGSEGV
{
std::lock_guard<std::mutex> lock(mtx);
vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
vkQueueWaitIdle(graphicsQueue);
}
vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
vkQueueWaitIdle(graphicsQueue);
vkFreeCommandBuffers(device, commandPool, 1, &commandBuffer);
}
@@ -1460,7 +1452,9 @@ void FaceApp::drawFrame(long long frameTime)
game_time = game_time - actionTime;
}
}
std::unique_lock<std::mutex> lock_point(mtx_point);
std::unique_lock<std::mutex> lock_changeMotion(changeMotionMtx);
std::unique_lock<std::mutex> lock_Texture(createTextureMtx);
Application::drawFrame(frameTime);
}
@@ -1620,3 +1614,4 @@ void FaceApp::StopMotion() {
void FaceApp::ResumeMotion() {
_playMotion = true;
}