diff options
author | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-10-19 09:39:22 +0300 |
---|---|---|
committer | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-10-19 12:45:53 +0300 |
commit | 20542f9546637bd649c928226249be0ffc91841b (patch) | |
tree | 9eccbe781a22a4cc7e905111eb1dcdfccec98e29 /src/opengl | |
parent | b9a3d4bf7827aa631995d47233d47583917a5a7f (diff) | |
download | qt4-tools-20542f9546637bd649c928226249be0ffc91841b.tar.gz |
Workaround to VideoCore III scissor bug.
Some versions of VideoCore III drivers seem
to pollute and use stencil buffer when using
glScissors. Workaround is to clear stencil buffer
before disabling scissoring.
Task-number: QT-5308
Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl_egl.cpp | 11 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 2 |
4 files changed, 16 insertions, 1 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 047d5890e4..999a0746f8 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -2059,6 +2059,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 3b3da431b8..af160d8c41 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1716,6 +1716,8 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) workaround_brokenTextureFromPixmap = false; workaround_brokenTextureFromPixmap_init = false; + workaround_brokenScissor = false; + for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) vertexAttributeArraysEnabledState[i] = false; } diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index a5891180f4..07134cf9e7 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -192,7 +192,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. @@ -229,6 +231,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 c56b2db806..d76f0b042a 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -415,6 +415,8 @@ public: uint workaround_brokenTextureFromPixmap : 1; uint workaround_brokenTextureFromPixmap_init : 1; + uint workaround_brokenScissor : 1; + QPaintDevice *paintDevice; QColor transpColor; QGLContext *q_ptr; |