summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2022-11-21 07:17:59 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-11-28 06:02:40 +0000
commit3e0a971602c62da8239b414a0f74c03f83cf18e3 (patch)
tree7deff995ee0ffb3b5c65e600d3b927b2d8402cd1
parentd67a1934416cfd65e930a95506d20076ffd28b30 (diff)
OpenGL SubmissionContext: reset defaultFBO every time we begin drawing
We wrongly assumed that the default FBO id would remain constant over time once the submission context had been initialized. However it appears that when using Qt3D with a QQuickWidget/QQuickRender control with offscreen surfaces, the default FBO might change over time as the offscreen surface might get recreated. To compute the proper render target size, we rely on comparing the default FBO id against the active FBO id being used at various times in the rendering process. If the default FBO has changed since initialization (due to an offscreen windows recreation on a resize for example), we run the risk of having invalid comparisons between the default FBO and current active FBO. This results in possible erronous render size values when going through SubmissionContext::renderTargetSize. This can lead to occasional flickering or the scene not rendering (getting a reported size of 1x1) when resizing a QQuickWidget holding a Scene3D. Change-Id: I18371e8e19213c472bdb64a6f339ee0941e5cb3d Reviewed-by: Sean Harmer <sean.harmer@kdab.com> (cherry picked from commit 0e5099cc5afaef043058a6b3b459aa7e815ddf9c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
index e53a004d5..afd78b3ce 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -481,6 +481,10 @@ bool SubmissionContext::beginDrawing(QSurface *surface)
}
m_boundArrayBuffer = nullptr;
+
+ // Record the default FBO value as there's no guarantee it remains constant over time
+ m_defaultFBO = m_gl->defaultFramebufferObject();
+
return true;
}