summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-01-24 22:08:17 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-01-25 14:46:43 +0100
commitb5bc4fd8b470cfe4198206e75c713dd71a22ffaa (patch)
tree5f49429fcc3d1a1ad9712b7ebe42e22f56560505
parentaf0ff55f166506137d3b5de861594519beb1729a (diff)
downloadqtlocation-mapboxgl-b5bc4fd8b470cfe4198206e75c713dd71a22ffaa.tar.gz
[macos] allow using the integrated GPU on dual-GPU machines
-rw-r--r--platform/darwin/src/headless_display_cgl.cpp2
-rw-r--r--platform/macos/app/Info.plist2
-rw-r--r--platform/macos/src/MGLOpenGLLayer.mm1
3 files changed, 5 insertions, 0 deletions
diff --git a/platform/darwin/src/headless_display_cgl.cpp b/platform/darwin/src/headless_display_cgl.cpp
index 90d187d3db..b38eb6b62c 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<CGLPixelFormatAttribute>(kCGLOGLPVersion_Legacy),
+ kCGLPFASupportsAutomaticGraphicsSwitching,
+ kCGLPFAAllowOfflineRenderers, // Allows using the integrated GPU
static_cast<CGLPixelFormatAttribute>(0)
};
diff --git a/platform/macos/app/Info.plist b/platform/macos/app/Info.plist
index cc7037f589..21b86bfc75 100644
--- a/platform/macos/app/Info.plist
+++ b/platform/macos/app/Info.plist
@@ -52,5 +52,7 @@
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
+ <key>NSSupportsAutomaticGraphicsSwitching</key>
+ <true/>
</dict>
</plist>
diff --git a/platform/macos/src/MGLOpenGLLayer.mm b/platform/macos/src/MGLOpenGLLayer.mm
index 296e30179b..8f8588486d 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];