diff options
author | Liang Qi <liang.qi@nokia.com> | 2011-10-25 12:56:51 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-10-25 12:56:51 (GMT) |
commit | bd0258ed73ecee28fba4c21027b2c2afd1b6af39 (patch) | |
tree | 136e780c13e0019382a315758d20e8ea43cf1c2d /src/opengl | |
parent | cb4eb590d4af9978a0d60402f3c4ab99b6f4ede4 (diff) | |
parent | ec6543371108bbe24fb8d98eb1ff057c641a0e9d (diff) | |
download | Qt-bd0258ed73ecee28fba4c21027b2c2afd1b6af39.zip Qt-bd0258ed73ecee28fba4c21027b2c2afd1b6af39.tar.gz Qt-bd0258ed73ecee28fba4c21027b2c2afd1b6af39.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts:
src/corelib/kernel/qeventdispatcher_symbian.cpp
src/declarative/qml/qdeclarativetypeloader.cpp
src/imports/gestures/gestures.pro
src/imports/particles/particles.pro
src/opengl/qgl.cpp
src/opengl/qgl_p.h
src/s60installs/bwins/QtGuiu.def
src/s60installs/eabi/QtGuiu.def
tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro
tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro
tests/auto/qaudioinput/qaudioinput.pro
tests/auto/qaudiooutput/qaudiooutput.pro
tests/auto/qchar/qchar.pro
tests/auto/qclipboard/test/test.pro
tests/auto/qsound/qsound.pro
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 8 | ||||
-rw-r--r-- | src/opengl/qgl_egl.cpp | 11 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 3 | ||||
-rw-r--r-- | src/opengl/qgl_symbian.cpp | 18 |
5 files changed, 32 insertions, 10 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index dbbb07c..f5fe739 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -2268,6 +2268,8 @@ void QGL2PaintEngineExPrivate::updateClipScissorTest() currentScissorBounds = bounds; if (bounds == QRect(0, 0, width, height)) { + if (ctx->d_func()->workaround_brokenScissor) + clearClip(0); glDisable(GL_SCISSOR_TEST); } else { glEnable(GL_SCISSOR_TEST); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 423fa08..6d95713 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1743,6 +1743,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) workaround_brokenTextureFromPixmap = false; workaround_brokenTextureFromPixmap_init = false; + workaround_brokenScissor = false; workaround_brokenAlphaTexSubImage = false; workaround_brokenAlphaTexSubImage_init = false; @@ -4381,7 +4382,7 @@ bool QGLWidget::event(QEvent *e) // if we've reparented a window that has the current context // bound, we need to rebind that context to the new window id if (d->glcx == QGLContext::currentContext()) - makeCurrent(); + makeCurrent(); // Shouldn't happen but keep it here just for sure if (testAttribute(Qt::WA_TranslucentBackground)) setContext(new QGLContext(d->glcx->requestedFormat(), this)); @@ -4389,8 +4390,11 @@ bool QGLWidget::event(QEvent *e) // A re-parent is likely to destroy the Symbian window and re-create it. It is important // that we free the EGL surface _before_ the winID changes - otherwise we can leak. - if (e->type() == QEvent::ParentAboutToChange) + if (e->type() == QEvent::ParentAboutToChange) { + if (d->glcx == QGLContext::currentContext()) + d->glcx->doneCurrent(); d->glcx->d_func()->destroyEglSurfaceForDevice(); + } if ((e->type() == QEvent::ParentChange) || (e->type() == QEvent::WindowStateChange)) { // The window may have been re-created during re-parent or state change - if so, the EGL diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 4de5122..0b96350 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -194,7 +194,9 @@ void QGLContext::makeCurrent() if (!d->workaroundsCached) { d->workaroundsCached = true; const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); - if (renderer && (strstr(renderer, "SGX") || strstr(renderer, "MBX"))) { + if (!renderer) + return; + if ((strstr(renderer, "SGX") || strstr(renderer, "MBX"))) { // PowerVR MBX/SGX chips needs to clear all buffers when starting to render // a new frame, otherwise there will be a performance penalty to pay for // each frame. @@ -231,6 +233,13 @@ void QGLContext::makeCurrent() d->workaround_brokenFBOReadBack = true; } } + } else if (strstr(renderer, "VideoCore III")) { + // Some versions of VideoCore III drivers seem to pollute and use + // stencil buffer when using glScissors even if stencil test is disabled. + // Workaround is to clear stencil buffer before disabling scissoring. + + // qDebug() << "Found VideoCore III driver, enabling brokenDisableScissorTest"; + d->workaround_brokenScissor = true; } } } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index de349a7..945bbaf 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -179,6 +179,7 @@ public: #endif #if defined(Q_OS_SYMBIAN) , eglSurfaceWindowId(0) + , surfaceSizeInitialized(false) #endif { isGLWidget = 1; @@ -224,6 +225,7 @@ public: #ifdef Q_OS_SYMBIAN void recreateEglSurface(); WId eglSurfaceWindowId; + bool surfaceSizeInitialized : 1; #endif }; @@ -426,6 +428,7 @@ public: uint workaround_brokenTextureFromPixmap : 1; uint workaround_brokenTextureFromPixmap_init : 1; + uint workaround_brokenScissor : 1; uint workaround_brokenAlphaTexSubImage : 1; uint workaround_brokenAlphaTexSubImage_init : 1; diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp index b8e5c22..94c63fc 100644 --- a/src/opengl/qgl_symbian.cpp +++ b/src/opengl/qgl_symbian.cpp @@ -259,7 +259,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as return true; } -void QGLWidget::resizeEvent(QResizeEvent *) +void QGLWidget::resizeEvent(QResizeEvent *e) { Q_D(QGLWidget); if (!isValid()) @@ -270,17 +270,18 @@ void QGLWidget::resizeEvent(QResizeEvent *) if (this == qt_gl_share_widget()) return; - if (QGLContext::currentContext()) - doneCurrent(); - - // Symbian needs to recreate the surface on resize. - d->recreateEglSurface(); + if (!d->surfaceSizeInitialized || e->oldSize() != e->size()) { + // On Symbian we need to recreate the surface on resize. + d->recreateEglSurface(); + d->surfaceSizeInitialized = true; + } makeCurrent(); + if (!d->glcx->initialized()) glInit(); + resizeGL(width(), height()); - //handle overlay } const QGLContext* QGLWidget::overlayContext() const @@ -363,6 +364,9 @@ void QGLWidgetPrivate::recreateEglSurface() WId currentId = q->winId(); if (glcx->d_func()->eglSurface != EGL_NO_SURFACE) { + if (glcx == QGLContext::currentContext()) + glcx->doneCurrent(); + eglDestroySurface(glcx->d_func()->eglContext->display(), glcx->d_func()->eglSurface); } |