From b5bc4fd8b470cfe4198206e75c713dd71a22ffaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 24 Jan 2017 22:08:17 +0100 Subject: [PATCH] [macos] allow using the integrated GPU on dual-GPU machines --- platform/darwin/src/headless_display_cgl.cpp | 2 ++ platform/macos/app/Info.plist | 2 ++ platform/macos/src/MGLOpenGLLayer.mm | 1 + 3 files changed, 5 insertions(+) diff --git a/platform/darwin/src/headless_display_cgl.cpp b/platform/darwin/src/headless_display_cgl.cpp index 90d187d3d..b38eb6b62 100644 --- a/platform/darwin/src/headless_display_cgl.cpp +++ b/platform/darwin/src/headless_display_cgl.cpp @@ -20,6 +20,8 @@ HeadlessDisplay::Impl::Impl() { CGLPixelFormatAttribute attributes[] = { kCGLPFAOpenGLProfile, static_cast(kCGLOGLPVersion_Legacy), + kCGLPFASupportsAutomaticGraphicsSwitching, + kCGLPFAAllowOfflineRenderers, // Allows using the integrated GPU static_cast(0) }; diff --git a/platform/macos/app/Info.plist b/platform/macos/app/Info.plist index cc7037f58..21b86bfc7 100644 --- a/platform/macos/app/Info.plist +++ b/platform/macos/app/Info.plist @@ -52,5 +52,7 @@ MainMenu NSPrincipalClass NSApplication + NSSupportsAutomaticGraphicsSwitching + diff --git a/platform/macos/src/MGLOpenGLLayer.mm b/platform/macos/src/MGLOpenGLLayer.mm index 296e30179..8f8588486 100644 --- a/platform/macos/src/MGLOpenGLLayer.mm +++ b/platform/macos/src/MGLOpenGLLayer.mm @@ -30,6 +30,7 @@ NSOpenGLPFADepthSize, 16, NSOpenGLPFAStencilSize, 8, NSOpenGLPFAScreenMask, mask, + NSOpenGLPFAAllowOfflineRenderers, // Allows using the integrated GPU 0 }; return [[NSOpenGLPixelFormat alloc] initWithAttributes:pfas];