diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-01-25 10:58:47 +0100 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-01-26 08:01:03 -0800 |
commit | e35c1f8c87354bb20f9485efa4e0d77ea5bf35b1 (patch) | |
tree | f4188e0a75f3a0784ccc052b6e3a0753e3c8ef57 /platform | |
parent | b826d043d01060acd96e568706f94cfab9163df6 (diff) | |
download | qtlocation-mapboxgl-e35c1f8c87354bb20f9485efa4e0d77ea5bf35b1.tar.gz |
[macos] align HeadlessDisplay with SDK OpenGL context creation options
Cherry-picked from 2a077eaa5483b243e817a328adaea1027a48e7a7.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/default/headless_display.cpp | 10 | ||||
-rw-r--r-- | platform/macos/src/MGLOpenGLLayer.mm | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/platform/default/headless_display.cpp b/platform/default/headless_display.cpp index aa57d66cdc..b61848d1a6 100644 --- a/platform/default/headless_display.cpp +++ b/platform/default/headless_display.cpp @@ -15,8 +15,14 @@ HeadlessDisplay::HeadlessDisplay() { // 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 523b585055..654fa4f2bc 100644 --- a/platform/macos/src/MGLOpenGLLayer.mm +++ b/platform/macos/src/MGLOpenGLLayer.mm @@ -24,6 +24,7 @@ - (NSOpenGLPixelFormat *)openGLPixelFormatForDisplayMask:(uint32_t)mask { NSOpenGLPixelFormatAttribute pfas[] = { + NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy, NSOpenGLPFAAccelerated, NSOpenGLPFAClosestPolicy, NSOpenGLPFAAccumSize, 32, |