summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-01-25 10:58:47 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-01-25 14:46:43 +0100
commit332e5bcc52058b9772fe7b4a4be28b2cff213380 (patch)
treec11e68320dbe74d04fb0e105aadbc5d1f76c4beb
parentb5bc4fd8b470cfe4198206e75c713dd71a22ffaa (diff)
downloadqtlocation-mapboxgl-332e5bcc52058b9772fe7b4a4be28b2cff213380.tar.gz
[macos] align HeadlessDisplay with SDK OpenGL context creation options
-rw-r--r--platform/darwin/src/headless_display_cgl.cpp10
-rw-r--r--platform/macos/src/MGLOpenGLLayer.mm1
2 files changed, 9 insertions, 2 deletions
diff --git a/platform/darwin/src/headless_display_cgl.cpp b/platform/darwin/src/headless_display_cgl.cpp
index b38eb6b62c..5b7a1f2bac 100644
--- a/platform/darwin/src/headless_display_cgl.cpp
+++ b/platform/darwin/src/headless_display_cgl.cpp
@@ -18,8 +18,14 @@ HeadlessDisplay::Impl::Impl() {
// TODO: test if OpenGL 4.1 with GL_ARB_ES2_compatibility is supported
// If it is, use kCGLOGLPVersion_3_2_Core and enable that extension.
CGLPixelFormatAttribute attributes[] = {
- kCGLPFAOpenGLProfile,
- static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_Legacy),
+ kCGLPFAOpenGLProfile, static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_Legacy),
+ // Not adding kCGLPFAAccelerated, as this will make headless rendering impossible when running in VMs.
+ kCGLPFAClosestPolicy,
+ kCGLPFAAccumSize, static_cast<CGLPixelFormatAttribute>(32),
+ kCGLPFAColorSize, static_cast<CGLPixelFormatAttribute>(24),
+ kCGLPFAAlphaSize, static_cast<CGLPixelFormatAttribute>(8),
+ kCGLPFADepthSize, static_cast<CGLPixelFormatAttribute>(16),
+ kCGLPFAStencilSize, static_cast<CGLPixelFormatAttribute>(8),
kCGLPFASupportsAutomaticGraphicsSwitching,
kCGLPFAAllowOfflineRenderers, // Allows using the integrated GPU
static_cast<CGLPixelFormatAttribute>(0)
diff --git a/platform/macos/src/MGLOpenGLLayer.mm b/platform/macos/src/MGLOpenGLLayer.mm
index 8f8588486d..16b4042ce1 100644
--- a/platform/macos/src/MGLOpenGLLayer.mm
+++ b/platform/macos/src/MGLOpenGLLayer.mm
@@ -22,6 +22,7 @@
- (NSOpenGLPixelFormat *)openGLPixelFormatForDisplayMask:(uint32_t)mask {
NSOpenGLPixelFormatAttribute pfas[] = {
+ NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy,
NSOpenGLPFAAccelerated,
NSOpenGLPFAClosestPolicy,
NSOpenGLPFAAccumSize, 32,