summaryrefslogtreecommitdiffstats
path: root/src/core/gl_surface_qt.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-11 09:08:50 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-11-11 12:05:38 +0100
commit39f7ce19dbce34dfa7e730d6fa743d88109c3369 (patch)
tree8b99513fe8a906807a0e3fac2780b9d1e6a63827 /src/core/gl_surface_qt.cpp
parent6c941affb2dd263d929b69afae3a0b9664869a9d (diff)
parent2d49b1b20f3275316310df599f1363ac86b8f078 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: src/core/content_browser_client_qt.cpp src/core/content_browser_client_qt.h src/core/gl_surface_qt.cpp src/core/print_view_manager_qt.cpp src/core/web_contents_delegate_qt.cpp src/core/web_engine_context.cpp src/webengine/doc/src/qtwebengine-overview.qdoc src/webengine/doc/src/qtwebengine-platform-notes.qdoc src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp src/webenginewidgets/webenginewidgets.pro sync.profile Change-Id: I44495f4d899580c882d6b86d68d7f6b77c8e91f6
Diffstat (limited to 'src/core/gl_surface_qt.cpp')
-rw-r--r--src/core/gl_surface_qt.cpp55
1 files changed, 32 insertions, 23 deletions
diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp
index e88a26715..74bb32d1f 100644
--- a/src/core/gl_surface_qt.cpp
+++ b/src/core/gl_surface_qt.cpp
@@ -90,6 +90,9 @@ void* g_display;
const char* g_extensions = NULL;
bool g_egl_surfaceless_context_supported = false;
+
+bool g_initializedEGL = false;
+
} // namespace
@@ -573,11 +576,17 @@ bool InitializeGLOneOffPlatform()
return GLSurfaceQtEGL::InitializeOneOff();
if (GetGLImplementation() == kGLImplementationDesktopGL) {
-#if defined(USE_X11)
- return GLSurfaceQtGLX::InitializeOneOff();
-#elif defined(OS_WIN)
+#if defined(OS_WIN)
return GLSurfaceQtWGL::InitializeOneOff();
+#elif defined(USE_X11)
+ if (GLSurfaceQtGLX::InitializeOneOff())
+ return true;
#endif
+ // Fallback to trying EGL with desktop GL.
+ if (GLSurfaceQtEGL::InitializeOneOff()) {
+ g_initializedEGL = true;
+ return true;
+ }
}
return false;
@@ -586,40 +595,40 @@ bool InitializeGLOneOffPlatform()
scoped_refptr<GLSurface>
CreateOffscreenGLSurface(const gfx::Size& size)
{
+ scoped_refptr<GLSurface> surface;
switch (GetGLImplementation()) {
case kGLImplementationDesktopGLCoreProfile:
case kGLImplementationDesktopGL: {
-#if defined(USE_X11)
- scoped_refptr<GLSurface> surface = new GLSurfaceQtGLX(size);
- if (!surface->Initialize())
- return NULL;
- return surface;
-#elif defined(OS_WIN)
- scoped_refptr<GLSurface> surface = new GLSurfaceQtWGL(size);
- if (!surface->Initialize())
- return NULL;
- return surface;
-#else
- LOG(ERROR) << "Desktop GL is not supported on this platform.";
- Q_UNREACHABLE();
- return NULL;
+#if defined(OS_WIN)
+ surface = new GLSurfaceQtWGL(size);
+ if (surface->Initialize())
+ return surface;
+ break;
+#elif defined(USE_X11)
+ if (!g_initializedEGL) {
+ surface = new GLSurfaceQtGLX(size);
+ if (surface->Initialize())
+ return surface;
+ }
+ // no break
#endif
}
case kGLImplementationEGLGLES2: {
- scoped_refptr<GLSurface> surface;
if (g_egl_surfaceless_context_supported)
surface = new GLSurfacelessQtEGL(size);
else
surface = new GLSurfaceQtEGL(size);
- if (!surface->Initialize())
- return NULL;
- return surface;
+ if (surface->Initialize())
+ return surface;
+ break;
}
default:
- Q_UNREACHABLE();
- return NULL;
+ break;
}
+ LOG(ERROR) << "Requested OpenGL platform is not supported.";
+ Q_UNREACHABLE();
+ return NULL;
}
scoped_refptr<GLSurface>