summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/main.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2020-03-12 03:52:47 -0400
committerGitHub <noreply@github.com>2020-03-12 03:52:47 -0400
commit15acce847d44564afcc5b49ef26171fe4c4e51d2 (patch)
tree92fb4573007ef87e27f5a7d7518e59f780fd9dec /Source/Core/VideoBackends/Vulkan/main.cpp
parentbb7623e3ba4c5ed1d7089e6c9be388d0f0272c2e (diff)
parentcdb0aa850da6fead21224eeed82df34e87e08fcc (diff)
Merge pull request #8666 from stenzek/fix-macos-vulkan-yet-again
Fix Vulkan/MoltenVK on macOS yet again
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/main.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/main.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/main.cpp b/Source/Core/VideoBackends/Vulkan/main.cpp
index 93b7e9dfe4..4d6b1296ac 100644
--- a/Source/Core/VideoBackends/Vulkan/main.cpp
+++ b/Source/Core/VideoBackends/Vulkan/main.cpp
@@ -304,7 +304,7 @@ static bool IsRunningOnMojaveOrHigher()
}
#endif
-void VideoBackend::PrepareWindow(const WindowSystemInfo& wsi)
+void VideoBackend::PrepareWindow(WindowSystemInfo& wsi)
{
#if defined(VK_USE_PLATFORM_MACOS_MVK)
// This is kinda messy, but it avoids having to write Objective C++ just to create a metal layer.
@@ -342,6 +342,10 @@ void VideoBackend::PrepareWindow(const WindowSystemInfo& wsi)
// layer.contentsScale = factor
reinterpret_cast<void (*)(id, SEL, double)>(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.