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-12-08 16:45:57 +0000
commit33b86b7a320796047df1e50a4c13c0c5d1d85ed4 (patch)
treee7145b1ef93abeba9c51634f6a86175863389a30
parent46955dd9c8860839927df4ac665b0b6e821466dd (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>
-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 833fac7b6..2b4da1ec7 100644
--- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -451,6 +451,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;
}