Skip to content

Commit

Permalink
Vulkan: Only attempt to create a CAMetalLayer on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
OatmealDome committed Jan 8, 2025
1 parent 9b3b6be commit 2633b84
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/Core/VideoBackends/Vulkan/VKMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ void VideoBackend::Shutdown()
void VideoBackend::PrepareWindow(WindowSystemInfo& wsi)
{
#if defined(VK_USE_PLATFORM_METAL_EXT)
// We only need to manually create the CAMetalLayer on macOS.
if (wsi.type != WindowSystemType::MacOS)
return;

// This is kinda messy, but it avoids having to write Objective C++ just to create a metal layer.
id view = reinterpret_cast<id>(wsi.render_surface);
Class clsCAMetalLayer = objc_getClass("CAMetalLayer");
Expand Down

0 comments on commit 2633b84

Please sign in to comment.