Bug 1349799 - Part 3: WebGL PowerPreference support on OSX; r?jgilbert
If choosing high power mode, we remove offline_renderer flag for
creating context. Otherwise, enabling offline_render.
MozReview-Commit-ID: FmX8BOGuhkC
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -215,16 +215,23 @@ static const NSOpenGLPixelFormatAttribut
0
};
static const NSOpenGLPixelFormatAttribute kAttribs_offscreen_accel[] = {
NSOpenGLPFAAccelerated,
0
};
+static const NSOpenGLPixelFormatAttribute kAttribs_offscreen_coreProfile_allow_offline[] = {
+ NSOpenGLPFAAccelerated,
+ NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
+ NSOpenGLPFAAllowOfflineRenderers,
+ 0
+};
+
static const NSOpenGLPixelFormatAttribute kAttribs_offscreen_coreProfile[] = {
NSOpenGLPFAAccelerated,
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
0
};
static NSOpenGLContext*
CreateWithFormat(const NSOpenGLPixelFormatAttribute* attribs)
@@ -304,17 +311,21 @@ CreateOffscreenFBOContext(CreateContextF
{
if (!sCGLLibrary.EnsureInitialized()) {
return nullptr;
}
NSOpenGLContext* context = nullptr;
if (!(flags & CreateContextFlags::REQUIRE_COMPAT_PROFILE)) {
- context = CreateWithFormat(kAttribs_offscreen_coreProfile);
+ if (flags & CreateContextFlags::HIGH_POWER) {
+ context = CreateWithFormat(kAttribs_offscreen_coreProfile);
+ } else {
+ context = CreateWithFormat(kAttribs_offscreen_coreProfile_allow_offline);
+ }
}
if (!context) {
if (flags & CreateContextFlags::ALLOW_OFFLINE_RENDERER) {
if (gfxPrefs::RequireHardwareGL())
context = CreateWithFormat(kAttribs_singleBuffered);
else
context = CreateWithFormat(kAttribs_offscreen_allow_offline);