From d1d08ef99f9b4ea6726df92ef313e320caf32f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Thu, 6 Apr 2017 16:00:09 +0200 Subject: [PATCH] Cocoa: Fix EGL support This adds support for using GLFW with EGL backends on macOS. While EGL isn't available by default on macOS, there are third-party implementations like SwiftShader. The addition of MoltenVK support added an override to makeBackingLayer. In non-Vulkan mode, this means that we are returning nil from that function. The NSGL implementation creates this layer manually later on, but other OpenGL backends don't necessarily do that. Closes #985. --- src/cocoa_window.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index d2b207bb..0c40c71a 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -423,6 +423,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (id)makeBackingLayer { + if (!window->ns.layer) { + window->ns.layer = [super makeBackingLayer]; + } return window->ns.layer; }