Merge pull request #13270 from OatmealDome/vk-metal-layer

Vulkan: Only attempt to create a CAMetalLayer on macOS
This commit is contained in:
OatmealDome 2025-01-15 15:08:03 -05:00 committed by GitHub
commit c344514ba2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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");