summaryrefslogtreecommitdiffstats
path: root/src/gui/egl
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-04-13 12:51:51 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-04-14 12:51:50 (GMT)
commitb331a74b8fd71ba803e2cf2a9e0c49e1d3538f40 (patch)
tree84937c7c4908cfc444fe6645a9373248c69fc946 /src/gui/egl
parent9ad274406a0f893f9a595aac7031deac2b25afbd (diff)
downloadQt-b331a74b8fd71ba803e2cf2a9e0c49e1d3538f40.zip
Qt-b331a74b8fd71ba803e2cf2a9e0c49e1d3538f40.tar.gz
Qt-b331a74b8fd71ba803e2cf2a9e0c49e1d3538f40.tar.bz2
Support building with desktop OpenGL managed via EGL
This mostly replaces lots of QT_OPENGL_ES defines with QT_NO_EGL instead. It also switches off EGL auto-detection by default. This is to make sure we default to using GLX on systems with both EGL and desktop OpenGL. If -opengl es1|es2 or -openvg is specified, then EGL auto-detection is switched back on (as a requirement. If configure auto-detects OpenGL ES it also switches on EGL auto-detection, but failue then just disables both EGL & OpenGL. As a side effect, this patch also fixes building Qt when both EGL and glx are avaliable, as they are in Mesa >= 7.8.0. Reviewed-by: Trond Task-number: QTBUG-9691
Diffstat (limited to 'src/gui/egl')
-rw-r--r--src/gui/egl/qegl.cpp9
-rw-r--r--src/gui/egl/qeglproperties.cpp27
2 files changed, 25 insertions, 11 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 6f215cc..3b007d7 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -326,10 +326,17 @@ EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties
bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties *properties)
{
// We need to select the correct API before calling eglCreateContext().
+#ifdef QT_OPENGL_ES
#ifdef EGL_OPENGL_ES_API
if (apiType == QEgl::OpenGL)
eglBindAPI(EGL_OPENGL_ES_API);
#endif
+#else
+#ifdef EGL_OPENGL_API
+ if (apiType == QEgl::OpenGL)
+ eglBindAPI(EGL_OPENGL_API);
+#endif
+#endif //defined(QT_OPENGL_ES)
#ifdef EGL_OPENVG_API
if (apiType == QEgl::OpenVG)
eglBindAPI(EGL_OPENVG_API);
@@ -339,7 +346,7 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties
QEglProperties contextProps;
if (properties)
contextProps = *properties;
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
if (apiType == QEgl::OpenGL)
contextProps.setValue(EGL_CONTEXT_CLIENT_VERSION, 2);
#endif
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index b5d3103..b34d2c3 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -80,19 +80,19 @@ int QEglProperties::value(int name) const
case EGL_GREEN_SIZE: return 0;
case EGL_BLUE_SIZE: return 0;
case EGL_ALPHA_SIZE: return 0;
-#if defined(EGL_LUMINANCE_SIZE)
+#ifdef EGL_LUMINANCE_SIZE
case EGL_LUMINANCE_SIZE: return 0;
#endif
-#if defined(EGL_ALPHA_MASK_SIZE)
+#ifdef EGL_ALPHA_MASK_SIZE
case EGL_ALPHA_MASK_SIZE: return 0;
#endif
-#if defined(EGL_BIND_TO_TEXTURE_RGB)
+#ifdef EGL_BIND_TO_TEXTURE_RGB
case EGL_BIND_TO_TEXTURE_RGB: return EGL_DONT_CARE;
#endif
-#if defined(EGL_BIND_TO_TEXTURE_RGBA)
+#ifdef EGL_BIND_TO_TEXTURE_RGBA
case EGL_BIND_TO_TEXTURE_RGBA: return EGL_DONT_CARE;
#endif
-#if defined(EGL_COLOR_BUFFER_TYPE)
+#ifdef EGL_COLOR_BUFFER_TYPE
case EGL_COLOR_BUFFER_TYPE: return EGL_RGB_BUFFER;
#endif
case EGL_CONFIG_CAVEAT: return EGL_DONT_CARE;
@@ -103,7 +103,7 @@ int QEglProperties::value(int name) const
case EGL_NATIVE_VISUAL_TYPE: return EGL_DONT_CARE;
case EGL_MAX_SWAP_INTERVAL: return EGL_DONT_CARE;
case EGL_MIN_SWAP_INTERVAL: return EGL_DONT_CARE;
-#if defined(EGL_RENDERABLE_TYPE)
+#ifdef EGL_RENDERABLE_TYPE
case EGL_RENDERABLE_TYPE: return EGL_OPENGL_ES_BIT;
#endif
case EGL_SAMPLE_BUFFERS: return 0;
@@ -115,7 +115,7 @@ int QEglProperties::value(int name) const
case EGL_TRANSPARENT_GREEN_VALUE: return EGL_DONT_CARE;
case EGL_TRANSPARENT_BLUE_VALUE: return EGL_DONT_CARE;
-#if defined(EGL_VERSION_1_3)
+#ifdef EGL_VERSION_1_3
case EGL_CONFORMANT: return 0;
case EGL_MATCH_NATIVE_PIXMAP: return EGL_NONE;
#endif
@@ -215,15 +215,18 @@ void QEglProperties::setPixelFormat(QImage::Format pixelFormat)
void QEglProperties::setRenderableType(QEgl::API api)
{
-#if defined(EGL_RENDERABLE_TYPE)
+#ifdef EGL_RENDERABLE_TYPE
#if defined(QT_OPENGL_ES_2)
if (api == QEgl::OpenGL)
setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT);
#elif defined(QT_OPENGL_ES)
if (api == QEgl::OpenGL)
setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
+#elif defined(EGL_OPENGL_BIT)
+ if (api == QEgl::OpenGL)
+ setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
#endif
-#if defined(EGL_OPENVG_BIT)
+#ifdef EGL_OPENVG_BIT
if (api == QEgl::OpenVG)
setValue(EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT);
#endif
@@ -272,7 +275,7 @@ bool QEglProperties::reduceConfiguration()
return true;
if (removeValue(EGL_DEPTH_SIZE))
return true;
-#if defined(EGL_BIND_TO_TEXTURE_RGB)
+#ifdef EGL_BIND_TO_TEXTURE_RGB
if (removeValue(EGL_BIND_TO_TEXTURE_RGB))
return true;
#endif
@@ -327,6 +330,10 @@ QString QEglProperties::toString() const
if ((val & EGL_OPENGL_ES2_BIT) != 0)
types += QLatin1String("es2");
#endif
+#ifdef EGL_OPENGL_BIT
+ if ((val & EGL_OPENGL_BIT) != 0)
+ types += QLatin1String("gl");
+#endif
if ((val & EGL_OPENVG_BIT) != 0)
types += QLatin1String("vg");
if ((val & ~7) != 0)