From 326c4d80f2ca68b2f677e5f86570417cbca467b9 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 30 Oct 2014 09:08:00 +0100 Subject: Fix disappearing nodes when adding in two levels of batch root When having e.g. a clip node inside another clip node and adding children to the innermost, we would get into the situation where we did a partial rebuild for the outermost root, but its available render order count would not be updated to reflect the change deeper down in the tree. Since the z range would be based on the outermost batch root's knowledge of the maximum render order in the tree, what would happen is that the z of the rendered nodes would increase steadily until they went outside of the viewing volume and disappeared. When decreasing the available order count of a batch root, we need to also decrease the available order count of its parents. If any of them drop below zero, we need to rebuild the render lists. [ChangeLog][QtQuick] Fixed nodes sometimes disappearing when adding many new nodes to the tree. Change-Id: I39c34acf0e1e0e87601f0fcd983f8da38cee029f Task-number: QTBUG-42096 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/quick/scenegraph/coreapi') diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 838251ed08..2f94bad75d 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -460,12 +460,18 @@ void Updater::visitGeometryNode(Node *n) if (e->root) { BatchRootInfo *info = renderer->batchRootInfo(e->root); - info->availableOrders--; - if (info->availableOrders < 0) { - renderer->m_rebuild |= Renderer::BuildRenderLists; - } else { - renderer->m_rebuild |= Renderer::BuildRenderListsForTaggedRoots; - renderer->m_taggedRoots << e->root; + while (info != 0) { + info->availableOrders--; + if (info->availableOrders < 0) { + renderer->m_rebuild |= Renderer::BuildRenderLists; + } else { + renderer->m_rebuild |= Renderer::BuildRenderListsForTaggedRoots; + renderer->m_taggedRoots << e->root; + } + if (info->parentRoot != 0) + info = renderer->batchRootInfo(info->parentRoot); + else + info = 0; } } else { renderer->m_rebuild |= Renderer::FullRebuild; -- cgit v1.2.3