Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Releasing Vulkan buffer resources across multiple frames in Qt framework
Qt 6.12 LTS is out! See what's new in the release blog

Releasing Vulkan buffer resources across multiple frames in Qt framework

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 368 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    joejack77
    wrote on last edited by joejack77
    #1

    Hey guys,

    I have a problem with my Vulkan app using Qt. I'm trying to release buffer resources, but this is the error message iam getting:

    vkDebug: Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] | MessageID = 0xe4549c11 | vkDestroyBuffer(): can't be called on VkBuffer 0xd68cbb0000000091[] that is currently in use by VkCommandBuffer 0x4959c00[].
    

    I've got buffers that I use for every frame, and i need to release resources, when creating new text with same text name.:

    void TextModule::createText(const std::string &fontName, uint32_t fontSize, const std::string &textName, const std::string &text, float scale,
                                  glm::vec2 middlePos, glm::vec2 windowSize, glm::vec4 color, e_TextRenderType renderType)
    {
        FontInfo fInfo = s_fontManager.loadedFont(fontName, fontSize);
    
    
        if (m_texts.find(textName) != m_texts.end())
        {
            Window *vw = MainWindow::instance()->vulkanWindow();
            for(int i = 0; i < m_instruments->concurrentFrameCount; i++)
            {
                m_texts[textName].bufArr[i].releaseResources();
            }
        }
    
    //more code
    
        for(int i = 0; i < m_instruments->concurrentFrameCount; i++)
        {
            textInfo.bufArr[i].createBuffer({textInfo.textVertices.size() * sizeof(base::graphics::ColorTexVertex)}, {BDSH::VX});
            textInfo.bufArr[i].set(textInfo.textVertices.data(), textInfo.textVertices.size() * sizeof(base::graphics::ColorTexVertex));
            textInfo.bufArr[i].mapWholeMemory();
            textInfo.bufArr[i].update();
            textInfo.bufArr[i].unMapMemory();
        }
        m_texts[textName] = textInfo;
    

    When i looked up Qt source code, it is waiting for fences for every frame. This is where problem occurs. I somehow need to wait for all fences, and then i can release the buffers. But Qt has it in private class, so i cant access it. I was thinking about changing Qt source code, so i can access fences or graphical queue, but first, i just want to ask you, if there is any better way, how to do it. Thank you guys in advance.

    Qt source code: https://codebrowser.dev/qt5/qtbase/src/gui/vulkan/qvulkanwindow.cpp.html

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt
    • Unsolved