summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-11-09 02:17:42 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-11-17 05:55:58 (GMT)
commit22d2f16625eab06211e298cb53285d6dae6c2504 (patch)
tree494b3e3c19d894769f8911fd650a86f953af2dd9
parentcad79f87813d54548a18e56b57e6ebf074fac19b (diff)
downloadQt-22d2f16625eab06211e298cb53285d6dae6c2504.zip
Qt-22d2f16625eab06211e298cb53285d6dae6c2504.tar.gz
Qt-22d2f16625eab06211e298cb53285d6dae6c2504.tar.bz2
Detect context sharing on EGL systems
Context sharing was enabled on EGL systems, but QGLContext::isSharing() was still returning false because the flag in QGLContextPrivate was not updated. Reviewed-by: Sarah Smith (cherry picked from commit f89fc92d1da06964a890e7800caeab62579a0fb4)
-rw-r--r--src/gui/egl/qegl.cpp4
-rw-r--r--src/gui/egl/qegl_p.h2
-rw-r--r--src/opengl/qgl_qws.cpp1
-rw-r--r--src/opengl/qgl_wince.cpp1
-rw-r--r--src/opengl/qgl_x11egl.cpp1
5 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 39291d3..c0e4890 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -62,6 +62,7 @@ QEglContext::QEglContext()
, currentSurface(EGL_NO_SURFACE)
, current(false)
, ownsContext(true)
+ , sharing(false)
{
}
@@ -174,6 +175,7 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties
if (apiType == QEgl::OpenGL)
contextProps.setValue(EGL_CONTEXT_CLIENT_VERSION, 2);
#endif
+ sharing = false;
if (shareContext && shareContext->ctx == EGL_NO_CONTEXT)
shareContext = 0;
if (shareContext) {
@@ -181,6 +183,8 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties
if (ctx == EGL_NO_CONTEXT) {
qWarning() << "QEglContext::createContext(): Could not share context:" << errorString(eglGetError());
shareContext = 0;
+ } else {
+ sharing = true;
}
}
if (ctx == EGL_NO_CONTEXT) {
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 16b5b16..51bdbbe 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -81,6 +81,7 @@ public:
bool isValid() const;
bool isCurrent() const;
+ bool isSharing() const { return sharing; }
QEgl::API api() const { return apiType; }
void setApi(QEgl::API api) { apiType = api; }
@@ -132,6 +133,7 @@ private:
EGLSurface currentSurface;
bool current;
bool ownsContext;
+ bool sharing;
static EGLDisplay getDisplay(QPaintDevice *device);
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
index 5e59975..de9c6ae 100644
--- a/src/opengl/qgl_qws.cpp
+++ b/src/opengl/qgl_qws.cpp
@@ -206,6 +206,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
d->eglContext = 0;
return false;
}
+ d->sharing = d->eglContext->isSharing();
#if defined(EGL_VERSION_1_1)
if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget)
diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp
index fea2d3a..86fe3ba 100644
--- a/src/opengl/qgl_wince.cpp
+++ b/src/opengl/qgl_wince.cpp
@@ -166,6 +166,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
d->eglContext = 0;
return false;
}
+ d->sharing = d->eglContext->isSharing();
#if defined(EGL_VERSION_1_1)
if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget)
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 9b20297..5325451 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -115,6 +115,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
d->eglContext = 0;
return false;
}
+ d->sharing = d->eglContext->isSharing();
#if defined(EGL_VERSION_1_1)
if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget)