QVulkanWindow freezes until window resize on macOS only
-
TL;DR:
The content of my QVulkanWindow widget freezes until I resize the MainWindow, on macOS only. Is this a known issue?
Context:
I've made a Vulkan-based Qt app (QMainWindow with Dock and GUI + QVulkanWindow centralWidget for rendered content). I've got the app binary running on Linux, macOS, and Windows.
On macOS only, the content of the QVulkanWindow widget will periodically freeze and not update until the window is resized. The only Vulkan-related code called upon resize is releaseSwapChainResources() and initSwapChainResources(). The only code at all that I am calling in either of those is to update the renderExtent with the new size in initSwapChainResources():
// Update render extent const QSize vkwSize = vr_qvw->swapChainImageSize(); VkExtent2D renderExtent = {static_cast<uint32_t>(vkwSize.width()), static_cast<uint32_t>(vkwSize.height())}; this->vr_vkw->updateExtent(renderExtent); this->vr_extent = renderExtent;
The only error-adjacent messages I get when running my application are expected artifacts of using Vulkan with Qt:
vkDebug: vkCreateMacOSSurfaceMVK() is deprecated. Use vkCreateMetalSurfaceEXT() from the VK_EXT_metal_surface extension. vkDebug: VK_ERROR_FEATURE_NOT_PRESENT: Metal does not support disabling primitive restart.
Illustration:
For example, my program when running can look like this:
And the render will freeze looking like that. While frozen, I can still interact with the application and with the QVulkanWindow in particular. For example, I'll right-click and drag to rotate the model down to see it from above. The content will not change and will still look like the above, because it is frozen.
But if I inspect the frames with XCode, I see that the MTLDrawablePresent HAS been updated correctly:
Upon resizing the MainWindow, which calls releaseSwapChainResources() and initSwapChainResources(), the QVulkanWindow will be unfrozen, updating to the new frame as seen in MTLDrawable present, and working correctly until it randomly freezes again. No error messages are displayed at any time.
I'm working on making an MRE, but that's taking time as my application uses a handmade, monolithic Vulkan program library. You can see the current source of my program here: https://github.com/nolnoch/atomix
Does anyone know why this would happen?
-
Hi,
Sorry I can't answer that question currently but I would suggest to add:
- which version of Qt you are using
- which version of macOS you are running your code on
- which version of the Vulkan library you have
By the way, are you using the same versions on each OS ?
-
Hi, I tried to update the post, but it says I can only edit within 30min.
Versions:
- Qt: 6.8.1 (issue present with 6.5.3 and 6.8.0) [for all platforms]
- Vulkan: 1.3.296 (with same SDK version of MoltenVK for macOS) [for all platforms]
- Windows: 11
- Linux: 24.04 LTS
- macOS: Sequoia 15.1.1
Yes, I use the same packages for all platforms.
-