diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview_drawing.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview_drawing.mm | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm index daa1a2e250..5d637bb6b6 100644 --- a/src/plugins/platforms/cocoa/qnsview_drawing.mm +++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm @@ -133,6 +133,12 @@ } } +- (BOOL)shouldUseMetalLayer:(QSurface::SurfaceType)surfaceType +{ + // MetalSurface needs a layer, and so does VulkanSurface (via MoltenVK) + return surfaceType == QWindow::MetalSurface || surfaceType == QWindow::VulkanSurface; +} + - (BOOL)wantsLayer { Q_ASSERT(m_platformWindow); @@ -144,16 +150,14 @@ bool layerRequested = qt_mac_resolveOption(false, m_platformWindow->window(), "_q_mac_wantsLayer", "QT_MAC_WANTS_LAYER"); - // Support Vulkan via MoltenVK, which requires a Metal layer - bool layerForVulkan = (m_platformWindow->window()->surfaceType() == QWindow::VulkanSurface); + bool layerForSurfaceType = [self shouldUseMetalLayer:m_platformWindow->window()->surfaceType()]; - return layerRequested || layerForVulkan; + return layerRequested || layerForSurfaceType; } - (CALayer *)makeBackingLayer { - // Support Vulkan via MoltenVK, which requires a Metal layer - bool makeMetalLayer = (m_platformWindow->window()->surfaceType() == QWindow::VulkanSurface); + bool makeMetalLayer = [self shouldUseMetalLayer:m_platformWindow->window()->surfaceType()]; if (makeMetalLayer) { // Check if Metal is supported. If it isn't then it's most likely // too late at this point and the QWindow will be non-functional, |