зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1150944 - Don't force the discrete GPU for skia gl. r=jrmuizel
This commit is contained in:
Родитель
501c8bec02
Коммит
04c916856f
|
@ -23,6 +23,8 @@ enum class CreateContextFlags : int8_t {
|
|||
REQUIRE_COMPAT_PROFILE = 1 << 0,
|
||||
// Force the use of hardware backed GL, don't allow software implementations.
|
||||
FORCE_ENABLE_HARDWARE = 1 << 1,
|
||||
/* Don't force discrete GPU to be used (if applicable) */
|
||||
ALLOW_OFFLINE_RENDERER = 1 << 2,
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CreateContextFlags)
|
||||
|
||||
|
|
|
@ -187,6 +187,11 @@ static const NSOpenGLPixelFormatAttribute kAttribs_offscreen[] = {
|
|||
0
|
||||
};
|
||||
|
||||
static const NSOpenGLPixelFormatAttribute kAttribs_offscreen_allow_offline[] = {
|
||||
NSOpenGLPFAAllowOfflineRenderers,
|
||||
0
|
||||
};
|
||||
|
||||
static const NSOpenGLPixelFormatAttribute kAttribs_offscreen_accel[] = {
|
||||
NSOpenGLPFAAccelerated,
|
||||
0
|
||||
|
@ -269,11 +274,19 @@ CreateOffscreenFBOContext(CreateContextFlags flags)
|
|||
if (!context) {
|
||||
profile = ContextProfile::OpenGLCompatibility;
|
||||
|
||||
if (flags & CreateContextFlags::ALLOW_OFFLINE_RENDERER) {
|
||||
if (gfxPrefs::RequireHardwareGL())
|
||||
context = CreateWithFormat(kAttribs_singleBuffered);
|
||||
else
|
||||
context = CreateWithFormat(kAttribs_offscreen_allow_offline);
|
||||
|
||||
} else {
|
||||
if (gfxPrefs::RequireHardwareGL())
|
||||
context = CreateWithFormat(kAttribs_offscreen_accel);
|
||||
else
|
||||
context = CreateWithFormat(kAttribs_offscreen);
|
||||
}
|
||||
}
|
||||
if (!context) {
|
||||
NS_WARNING("Failed to create NSOpenGLContext.");
|
||||
return nullptr;
|
||||
|
|
|
@ -1090,7 +1090,8 @@ gfxPlatform::GetSkiaGLGlue()
|
|||
* stands, this only works on the main thread.
|
||||
*/
|
||||
nsRefPtr<GLContext> glContext;
|
||||
glContext = GLContextProvider::CreateHeadless(CreateContextFlags::REQUIRE_COMPAT_PROFILE);
|
||||
glContext = GLContextProvider::CreateHeadless(CreateContextFlags::REQUIRE_COMPAT_PROFILE |
|
||||
CreateContextFlags::ALLOW_OFFLINE_RENDERER);
|
||||
if (!glContext) {
|
||||
printf_stderr("Failed to create GLContext for SkiaGL!\n");
|
||||
return nullptr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче