Skip to content

crash when use QtVulkan #3

Open

Description

@173619070

crash code:
(file :VulkanBase.cxx, project:QtVulkanSceneDemo)

void VulkanBase::draw() {
    if (m_stop or m_pause) return;
    m_signalFrame = false;
    prepareFrame();

    // Command buffer to be sumitted to the queue
    m_submitInfo.commandBufferCount = 1;
    m_submitInfo.pCommandBuffers = &m_drawCmdBuffers[m_currentBuffer];

    // Submit to queue
    if (m_prepared) {
        VK_CHECK_RESULT(vkQueueSubmit(m_queue, 1, &m_submitInfo, VK_NULL_HANDLE));/////<-------crash
    }

    submitFrame();
    m_signalFrame = true;
}

Activity

  1. 173619070 commented on Feb 3, 2023

    @173619070
    Author

    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));
    }
    
    
  2. engineer1109 commented on Feb 3, 2023

    @engineer1109
    Owner

    @173619070 Are you on Intel?

  3. self-assigned this
    on Feb 3, 2023
  4. 173619070 commented on Feb 3, 2023

    @173619070
    Author

    @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.

  5. engineer1109 commented on Feb 5, 2023

    @engineer1109
    Owner

    @173619070 210c9dc should fix intel crash.
    Wait for fence suggestion I need time to check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions