Using QRhiWidget with a Vulkan backend on macOS
-
Hi all,
I'm trying to use the new QRhiWidget with a Vulkan backend on macOS.
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's waiting for a Vulkan fence...
I added a screenshot of the stacktrace below:
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 the QRhiWidget is broken when used in combination with Vulkan on macOS. Can others confirm this? Or am I overlooking something?