From 3e14de57df79ef0208e1356e8cffde37b573c00d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> Date: Wed, 20 May 2015 12:58:21 +0300 Subject: [PATCH] Actual fix for "shaking" bug that occurred in some GPUs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first FBO we create gets corrupted by something outside Canvas3D in some cases. E.g. changing the text in an completely unrelated Text element may corrupt Canvas3D FBOs. This only happens with some GPU drivers, likely due to a bug in the drivers themselves. To work around the issue, the first FBO we create is a dummy that we delete once the real FBOs are done. Change-Id: Ie8c2a0ec3899c3eb22e4de8809c3b41607cc83c3 Task-number: QTBUG-46101 Reviewed-by: Pasi Keränen <pasi.keranen@digia.com> --- src/imports/qtcanvas3d/canvas3d.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/imports/qtcanvas3d/canvas3d.cpp b/src/imports/qtcanvas3d/canvas3d.cpp index c84bc18..439fa50 100644 --- a/src/imports/qtcanvas3d/canvas3d.cpp +++ b/src/imports/qtcanvas3d/canvas3d.cpp @@ -537,6 +537,15 @@ void Canvas::createFBOs() QOpenGLFramebufferObject *renderFbo = m_renderFbo; QOpenGLFramebufferObject *antialiasFbo = m_antialiasFbo; + QOpenGLFramebufferObject *dummyFbo = 0; + if (!m_renderFbo) { + // Create a dummy FBO to work around a weird GPU driver bug on some platforms that + // causes the first FBO created to get corrupted in some cases. + dummyFbo = new QOpenGLFramebufferObject(m_fboSize.width(), + m_fboSize.height(), + m_fboFormat); + } + // Create FBOs qCDebug(canvas3drendering).nospace() << "Canvas3D::" << __FUNCTION__ << " Creating front and back FBO's with" @@ -590,6 +599,9 @@ void Canvas::createFBOs() bindCurrentRenderTarget(); emitNeedRender(); } + + // Get rid of the dummy FBO, it has served its purpose + delete dummyFbo; } /*! -- GitLab