Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-103021

Use the QVulkanInstance without QPA

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • Not Evaluated
    • None
    • 6.3.0
    • GUI: Vulkan
    • None
    • All

    Description

      I have a existing VkInstance object, It's from the wlroots library, I need use it for a QQuickWindow, for a example:

      auto vkInstance = wlr_vk_renderer_get_instance(renderer()); 
      auto qvkInstance = new QVulkanInstance();
      qvkInstance->setVkInstance(vkInstance);
      
      // If we can direct assignment by QVulkanInstancePrivate, then don't need create QPlatformVulkanInstance in the QVulkanInstancePrivate::::ensureVulkan 
      // QVulkanInstancePrivate::get(qvkInstance)->platformInst.reset(new CustomPlatformVulkanInstance);
      // If the QVulkanInstancePrivate::platformInst is null, there request create a QPlatformVulkanInstance object from QPA 
      qvkInstance->create();
      
      QQuickWindow *window;
      ...
      auto wd = QWindowPrivate::get(window);
      wd->platformWindow = new OutputWindow(); // My custom platform window, it's use the wlroots library and without the QPA.
      window->setVulkanInstance(qvkInstance);
      
      auto phdev = wlr_vk_renderer_get_phdev(renderer());
      window->setGraphicsDevice(QQuickGraphicsDevice::fromPhysicalDevice(phdev));
      ...
      auto vkImage = wlr_vk_renderer_get_current_image(renderer());
      auto rt = QQuickRenderTarget::fromVulkanImage(vkImage, VK_IMAGE_LAYOUT_PREINITIALIZED, size());
      window->setRenderTarget(rt);
      

      In the QVulkanInstance::create function, It's will create the QPlatformVulkanInstance object from QPA, I want to use a custom QPlatformVulkanInstance class for the QVulkanInstance, ensure the QVulkanInstance's all function is with the wlroots library, not from the QPA, so I can't call the QVulkanInstance::create function in there. But there is no other way to assign my custom QPlatformVulkanInstance object to a QVulkanInstance.

      Attachments

        For Gerrit Dashboard: QTBUG-103021
        # Subject Branch Project Status CR V

        Activity

          People

            lagocs Laszlo Agocs
            zccrs JiDe Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes