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

Using QRhiWidget with a Vulkan backend on macOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7.1
    • Qt RHI
    • None
    • macOS

    Description

      I'm trying to use the new QRhiWidget with a Vulkan backend on macOS.
      We want to integrate our existing Vulkan code into an existing Qt project. The idea is to force a Vulkan backend for the QRhiWidget in combination with QRhiCommandBuffer::ExternalContent.

      My first step is to get the Simple RHI Widget example running on my machine:

      • I installed the Vulkan SDK which includes MoltenVK
      • I compiled Qt 6.7.1 myself to enable Vulkan support in Qt (somewhere in the configure output it mentions “Vulkan ...... Yes”)
      • As QRhiWidget uses Metal as the default backend on macOS, I added following line to the example code to ensure Vulkan is used (added to the constructor of ExampleRhiWidget):
       setApi(QRhiWidget::Api::Vulkan);
      • I set the QT_VULKAN_LIB environment variable to the location where libMoltenVK.dylib is located

      After these steps, I was hoping to successfully run the example application. However, the application hangs on startup.
      It seems that for some reason in src/plugins/platforms/cocoa/qnsview_drawing.mm, the displayLayer() function is constantly being called without returning to the qt event loop in between. I suspect this explains why the application hangs...

      When using Metal or OpenGL in the setAPI statement, the example runs fine.
      Next to that I tried to run the Hello Vulkan Cubes example to make sure my Vulkan/MoltenVK setup is working properly. This example (which isn't using QRhiWidget) is working fine.

      So I suspect something in QRhi(Widget) is broken when used in combination with Vulkan on macOS.

      Attachments

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

        Activity

          People

            lagocs Laszlo Agocs
            dbutijn David Butijn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes