diff options
author | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-05-10 20:41:09 (GMT) |
---|---|---|
committer | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-06-09 10:31:54 (GMT) |
commit | 489baff3d49f7acce8d36dd98d27885ca207d6e7 (patch) | |
tree | f9b7a0decd67048b52c0513b7665ccd46135a8ce /src/opengl/qwindowsurface_gl.cpp | |
parent | 7b0762c17f9899e68c0f67480a81b25c6f0c7dda (diff) | |
download | Qt-489baff3d49f7acce8d36dd98d27885ca207d6e7.zip Qt-489baff3d49f7acce8d36dd98d27885ca207d6e7.tar.gz Qt-489baff3d49f7acce8d36dd98d27885ca207d6e7.tar.bz2 |
Simplify texture pooling logic in GL graphics system.
Remove ugly TemporarilyCachedBindOption and use QGLTexture
objects as texture pool entries instead of QGLPixmapData.
Make texture pooling totally Symbian specific, remove
VG like texture pooling code and use common texture binding
path which is used on other platforms also on Symbian.
QGLPixmapData should be only used to bind SgImage based
textures (will be implemented by another commit).
Task-number: QTBUG-19180
Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/opengl/qwindowsurface_gl.cpp')
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 62 |
1 files changed, 8 insertions, 54 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 238d127..17b2044 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -184,7 +184,7 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL) class QGLGlobalShareWidget { public: - QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) {} + QGLGlobalShareWidget() : refCount(0), widget(0), initializing(false) {} QGLWidget *shareWidget() { if (!initializing && !widget && !cleanedUp) { @@ -223,9 +223,7 @@ public: } static bool cleanedUp; - - QGLPixmapData *firstPixmap; - int widgetRefCount; + int refCount; private: QGLWidget *widget; @@ -257,43 +255,6 @@ void qt_destroy_gl_share_widget() _qt_gl_share_widget()->destroy(); } -#ifdef QGL_USE_TEXTURE_POOL -void qt_gl_register_pixmap(QGLPixmapData *pd) -{ - QGLGlobalShareWidget *shared = _qt_gl_share_widget(); - pd->next = shared->firstPixmap; - pd->prev = 0; - if (shared->firstPixmap) - shared->firstPixmap->prev = pd; - shared->firstPixmap = pd; -} - -void qt_gl_unregister_pixmap(QGLPixmapData *pd) -{ - if (pd->next) - pd->next->prev = pd->prev; - if (pd->prev) { - pd->prev->next = pd->next; - } else { - QGLGlobalShareWidget *shared = _qt_gl_share_widget(); - if (shared) - shared->firstPixmap = pd->next; - } -} - -void qt_gl_hibernate_pixmaps() -{ - QGLGlobalShareWidget *shared = _qt_gl_share_widget(); - - // Scan all QGLPixmapData objects in the system and hibernate them. - QGLPixmapData *pd = shared->firstPixmap; - while (pd != 0) { - pd->hibernate(); - pd = pd->next; - } -} -#endif - struct QGLWindowSurfacePrivate { QGLFramebufferObject *fbo; @@ -393,18 +354,10 @@ QGLWindowSurface::~QGLWindowSurface() if (QGLGlobalShareWidget::cleanedUp) return; - --(_qt_gl_share_widget()->widgetRefCount); - -#ifdef QGL_USE_TEXTURE_POOL - if (_qt_gl_share_widget()->widgetRefCount <= 0) { - // All of the widget window surfaces have been destroyed - // but we still have GL pixmaps active. Ask them to hibernate - // to free up GPU resources until a widget is shown again. - // This may eventually cause the EGLContext to be destroyed - // because nothing in the system needs a context, which will - // free up even more GPU resources. - qt_gl_hibernate_pixmaps(); + --(_qt_gl_share_widget()->refCount); +#ifdef Q_OS_SYMBIAN + if (_qt_gl_share_widget()->refCount <= 0) { // Destroy the context if necessary. if (!qt_gl_share_widget()->context()->isSharing()) qt_destroy_gl_share_widget(); @@ -458,7 +411,7 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) ctx->create(qt_gl_share_widget()->context()); if (widget != qt_gl_share_widget()) - ++(_qt_gl_share_widget()->widgetRefCount); + ++(_qt_gl_share_widget()->refCount); #ifndef QT_NO_EGL static bool checkedForNOKSwapRegion = false; @@ -495,6 +448,7 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) voidPtr = &widgetPrivate->extraData()->glContext; d_ptr->contexts << ctxPtr; + #ifndef Q_OS_SYMBIAN qDebug() << "hijackWindow() context created for" << widget << d_ptr->contexts.size(); #endif @@ -870,7 +824,7 @@ void QGLWindowSurface::updateGeometry() { #ifdef Q_OS_SYMBIAN // Symbian needs to recreate the context when native window size changes if (d_ptr->size != geometry().size()) { if (window() != qt_gl_share_widget()) - --(_qt_gl_share_widget()->widgetRefCount); + --(_qt_gl_share_widget()->refCount); delete wd->extraData()->glContext; wd->extraData()->glContext = 0; |