diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-05 09:56:14 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-05 10:46:21 +0200 |
commit | 8bcb127848a2fb533fc923e7e266dd4d56251201 (patch) | |
tree | ba22114242235d63f0ff8fdc78351c355f0edaad /src/quick/scenegraph/qsgthreadedrenderloop.cpp | |
parent | aad6ef27e792b107a99615c04b0ae726a4091e79 (diff) |
rhi: Do not sync with zero sized, non-initialized windows
Change-Id: I0f8583a67b1838b4314ff48173a3e5029ddd6c1d
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 6237114f0e..04df601b28 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -622,12 +622,18 @@ void QSGRenderThread::sync(bool inExpose, bool inGrab) } } } else if (rhi) { - // With the rhi making the (OpenGL) context current serves only one - // purpose: to enable external OpenGL rendering connected to one of - // the QQuickWindow signals (beforeSynchronizing, beforeRendering, - // etc.) to function like it did on the direct OpenGL path. For our - // own rendering this call would not be necessary. - rhi->makeThreadLocalNativeContextCurrent(); + if (windowSize.width() > 0 && windowSize.height() > 0) { + // With the rhi making the (OpenGL) context current serves only one + // purpose: to enable external OpenGL rendering connected to one of + // the QQuickWindow signals (beforeSynchronizing, beforeRendering, + // etc.) to function like it did on the direct OpenGL path. For our + // own rendering this call would not be necessary. + rhi->makeThreadLocalNativeContextCurrent(); + } else { + // Zero size windows do not initialize a swapchain and + // rendercontext. So no sync or render can be done then. + current = false; + } } else { current = false; } @@ -823,6 +829,8 @@ void QSGRenderThread::syncAndRender(QImage *grabImage) else rhi->makeThreadLocalNativeContextCurrent(); } else { + // Zero size windows do not initialize a swapchain and + // rendercontext. So no sync or render can be done then. current = false; } // Check for context loss (GL, RHI case handled after the beginFrame() above) |