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

Use the QVulkanInstance without QPA

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 6.3.0
    • Fix Version/s: None
    • Component/s: GUI: Vulkan
    • Labels:
      None
    • Platform/s:
      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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            lagocs Laszlo Agocs
            Reporter:
            zccrs chen 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