diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2015-01-12 17:34:42 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-02-03 14:05:30 +0000 |
commit | 5d4df794665914d5452213f0f69b9aad151ddbf4 (patch) | |
tree | 8e245c022d4108ed869ec9bb6a20c49fcc4dbbba /src | |
parent | fa78127622424fba161f5f42e9e76c72e653828a (diff) |
Handle context lost in the Windows render loop
With ANGLE (which always uses this loop) EGL_CONTEXT_LOST
may happen quite often, depending on various factors.
It is therefore good to handle this by tearing down and
reinitializing the scenegraph.
Task-number: QTBUG-43263
Change-Id: I8e985e001f46865ccd814255f39add58fe2a737a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/scenegraph/qsgwindowsrenderloop.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index 9f74e259e3..318bb28f19 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -401,8 +401,17 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window) if (!d->isRenderable()) return; - if (!m_gl->makeCurrent(window)) - return; + if (!m_gl->makeCurrent(window)) { + // Check for context loss. + if (!m_gl->isValid()) { + d->cleanupNodesOnShutdown(); + m_rc->invalidate(); + if (m_gl->create() && m_gl->makeCurrent(window)) + m_rc->initialize(m_gl); + else + return; + } + } d->flushDelayedTouchEvent(); // Event delivery or processing has caused the window to stop rendering. |