diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-01 07:52:09 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-01 07:52:09 (GMT) |
commit | 871bdaff6d7ae05571830ae87d9de6ef4e2cdb9f (patch) | |
tree | d9dcf9d8437c7a7777f64ce41f5f55a44269fee7 /src/opengl/qgl.cpp | |
parent | f23ab31348bb6d3c6b7cb1ccf429ea932824e4e4 (diff) | |
download | Qt-871bdaff6d7ae05571830ae87d9de6ef4e2cdb9f.zip Qt-871bdaff6d7ae05571830ae87d9de6ef4e2cdb9f.tar.gz Qt-871bdaff6d7ae05571830ae87d9de6ef4e2cdb9f.tar.bz2 |
QGLContext::areSharing() to check for GL share relationships
Reviewed-by: Samuel
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r-- | src/opengl/qgl.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 1276443..bfb004e 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2254,7 +2254,7 @@ QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum targe Q_Q(QGLContext); QGLTexture *texture = QGLTextureCache::instance()->getTexture(key); if (texture && texture->target == target - && (texture->context == q || qgl_share_reg()->checkSharing(q, texture->context))) + && (texture->context == q || QGLContext::areSharing(q, texture->context))) { return texture; } @@ -2755,6 +2755,20 @@ void QGLContext::setDevice(QPaintDevice *pDev) */ /*! + Returns true if \a context1 and \a context2 are sharing their + GL resources such as textures, shader programs, etc; + otherwise returns false. + + \since 4.6 +*/ +bool QGLContext::areSharing(const QGLContext *context1, const QGLContext *context2) +{ + if (!context1 || !context2) + return false; + return context1->d_ptr->group == context2->d_ptr->group; +} + +/*! \fn bool QGLContext::deviceIsPixmap() const Returns true if the paint device of this context is a pixmap; @@ -4835,11 +4849,6 @@ Q_OPENGL_EXPORT const QString qt_gl_library_name() } #endif -bool QGLShareRegister::checkSharing(const QGLContext *context1, const QGLContext *context2) { - bool sharing = (context1 && context2 && context1->d_ptr->group == context2->d_ptr->group); - return sharing; -} - void QGLShareRegister::addShare(const QGLContext *context, const QGLContext *share) { Q_ASSERT(context && share); if (context->d_ptr->group == share->d_ptr->group) |