summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-07-19 10:16:31 +0200
committerPaul Lemire <paul.lemire@kdab.com>2019-07-19 10:56:24 +0200
commit0e250e9e943daf88df09f1ad1bd11a46e1084da0 (patch)
tree405b1a8162df4e6653e9f10cd8baf2c6884f840b
parenta576ce8e0e4a5fb0aa2a09523f17522f0357faae (diff)
Renderer: use last known good surface to reset render states
We were instead checking against the last surface used (which could be null) instead of the last known good surface to reset the render states. This could result in not resetting the render states and keeping dangling pointers around. To know if we can render, we check find the first non null surface in the list of RV. In most cases we can safelly assume that if first RV has a surface, all following ones will likely use the same surface. If we have no good surface we skip the rendering. However in the case you have a FG where the first RV has a surface but not the last one (which wouldn't really make sense but can happen if you mess up), we could end up in the above case where surface is nullptr though we have partially rendered something for the RV which had valid surfaces. Change-Id: I902b8c7a943ad2ca7e2f487873f73990cf8db433 Reviewed-by: Mike Krus <mike.krus@kdab.com>
-rw-r--r--src/render/renderers/opengl/renderer/renderer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/render/renderers/opengl/renderer/renderer.cpp b/src/render/renderers/opengl/renderer/renderer.cpp
index 59949ee34..aeb3e513d 100644
--- a/src/render/renderers/opengl/renderer/renderer.cpp
+++ b/src/render/renderers/opengl/renderer/renderer.cpp
@@ -1585,7 +1585,7 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Ren
// Reset state and call doneCurrent if the surface
// is valid and was actually activated
- if (surface && m_submissionContext->hasValidGLHelper()) {
+ if (lastUsedSurface && m_submissionContext->hasValidGLHelper()) {
// Reset state to the default state if the last stateset is not the
// defaultRenderStateSet
if (m_submissionContext->currentStateSet() != m_defaultRenderStateSet)