summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-01-24 22:08:17 +0100
committerMinh Nguyễn <mxn@1ec5.org>2017-01-26 08:01:03 -0800
commitb826d043d01060acd96e568706f94cfab9163df6 (patch)
tree130566809315f3218e2f61237b342f0561fbac41
parent01ceae1a8e1d64251744e357bd4f3335853ff663 (diff)
downloadqtlocation-mapboxgl-b826d043d01060acd96e568706f94cfab9163df6.tar.gz
[macos] allow using the integrated GPU on dual-GPU machines
Cherry-picked from e7a7c6be789198a8155dc229ea509dd7aecf4756.
-rw-r--r--platform/default/headless_display.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/default/headless_display.cpp b/platform/default/headless_display.cpp
index b98aef7903..aa57d66cdc 100644
--- a/platform/default/headless_display.cpp
+++ b/platform/default/headless_display.cpp
@@ -17,6 +17,8 @@ HeadlessDisplay::HeadlessDisplay() {
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 e8fa521351..523b585055 100644
--- a/platform/macos/src/MGLOpenGLLayer.mm
+++ b/platform/macos/src/MGLOpenGLLayer.mm
@@ -32,6 +32,7 @@
NSOpenGLPFADepthSize, 16,
NSOpenGLPFAStencilSize, 8,
NSOpenGLPFAScreenMask, mask,
+ NSOpenGLPFAAllowOfflineRenderers, // Allows using the integrated GPU
0
};
return [[NSOpenGLPixelFormat alloc] initWithAttributes:pfas];