From fb947296b07bab48ae33ebebb5bb29624a488d71 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 11 Mar 2020 23:11:24 +1000 Subject: [PATCH] Vulkan: Pass CAMetalLayer to MoltenVK instead of NSView Gets rid of the warning for calling [NSView layer] off the main thread. --- Source/Core/VideoBackends/Vulkan/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Core/VideoBackends/Vulkan/main.cpp b/Source/Core/VideoBackends/Vulkan/main.cpp index 80063ff844..4d6b1296ac 100644 --- a/Source/Core/VideoBackends/Vulkan/main.cpp +++ b/Source/Core/VideoBackends/Vulkan/main.cpp @@ -342,6 +342,10 @@ void VideoBackend::PrepareWindow(WindowSystemInfo& wsi) // layer.contentsScale = factor reinterpret_cast(objc_msgSend)(layer, sel_getUid("setContentsScale:"), factor); + + // Store the layer pointer, that way MoltenVK doesn't call [NSView layer] outside the main thread. + wsi.render_surface = layer; + // The Metal version included with MacOS 10.13 and below does not support several features we // require. Furthermore, the drivers seem to choke on our shaders (mainly Intel). So, we warn // the user that this is an unsupported configuration, but permit them to continue.