Open 173619070 opened 1 year ago
fixed reacquire next image after call windowResize
void VulkanBase::prepareFrame() {
if (m_pause or !m_prepared) {
return;
}
// Acquire the next image from the swap chain
VkResult err = m_swapChain.acquireNextImage(m_semaphores.presentComplete, &m_currentBuffer);
// Recreate the swapchain if it's no longer compatible with the surface (OUT_OF_DATE) or no longer optimal for presentation (SUBOPTIMAL)
if ((err == VK_ERROR_OUT_OF_DATE_KHR) || (err == VK_SUBOPTIMAL_KHR)) {
LOGI("VulkanEngine VK_ERROR_OUT_OF_DATE_KHR");
windowResize();
//////////////-----reacquire next image
VkResult err = m_swapChain.acquireNextImage(m_semaphores.presentComplete, &m_currentBuffer);
if ((err == VK_ERROR_OUT_OF_DATE_KHR) || (err == VK_SUBOPTIMAL_KHR)) {
LOGI("VulkanEngine VK_ERROR_OUT_OF_DATE_KHR");
}
} else {
VK_CHECK_RESULT(err);
}
VK_CHECK_RESULT(vkQueueWaitIdle(m_queue));
}
@173619070 Are you on Intel?
@173619070 Are you on Intel? yes, Intel UHD Graphics 620,i used the Intel graphics card before. then I tried to replace it with an independent graphics card(NVIDIA MX150). and there was no crash now,thanks a lot! but i think it is more efficient to use the vkWaitForFences instead of vkQueueWaitIdle when submit or present, what do you think.
@173619070 https://github.com/engineer1109/LearnVulkan/commit/210c9dc0ba290243f91f8c21d03243ff60d3243b should fix intel crash. Wait for fence suggestion I need time to check.
crash code: (file :VulkanBase.cxx, project:QtVulkanSceneDemo)