From 64586be2c793a2743279d613b485c24f45f74327 Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Mon, 29 Nov 2021 17:43:05 +0000 Subject: [PATCH] Sort transform components in breadth first order per scene Change-Id: Iad835c30b6d83554bc2a150516c23dbd19183937 --- dali/internal/update/manager/transform-manager.cpp | 10 +++++++++- dali/internal/update/manager/transform-manager.h | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/dali/internal/update/manager/transform-manager.cpp b/dali/internal/update/manager/transform-manager.cpp index d61acc2..fe4d4f3 100644 --- a/dali/internal/update/manager/transform-manager.cpp +++ b/dali/internal/update/manager/transform-manager.cpp @@ -354,6 +354,8 @@ void TransformManager::ReorderComponents() { mOrderedComponents.Resize(mComponentCount); + unsigned int sceneId = 0; + TransformId parentId; for(TransformId i = 0; i < mComponentCount; ++i) { @@ -361,10 +363,16 @@ void TransformManager::ReorderComponents() mOrderedComponents[i].level = 0u; parentId = mParent[i]; + if(parentId == INVALID_TRANSFORM_ID) + { + mOrderedComponents[i].sceneId = sceneId++; + } + while(parentId != INVALID_TRANSFORM_ID) { mOrderedComponents[i].level++; - parentId = mParent[mIds[parentId]]; + parentId = mParent[mIds[parentId]]; + mOrderedComponents[i].sceneId = mOrderedComponents[mIds[mParent[i]]].sceneId; } } diff --git a/dali/internal/update/manager/transform-manager.h b/dali/internal/update/manager/transform-manager.h index abb830b..26936a8 100644 --- a/dali/internal/update/manager/transform-manager.h +++ b/dali/internal/update/manager/transform-manager.h @@ -376,11 +376,19 @@ private: { bool operator<(const SOrderItem& item) const { - return level < item.level; + if(sceneId != item.sceneId) + { + return sceneId < item.sceneId; + } + else + { + return level < item.level; + } } TransformId id; - uint32_t level; + uint16_t sceneId; + uint16_t level; }; /** @@ -392,7 +400,8 @@ private: /** * Reorders components in hierarchical order so update can iterate sequentially - * updating the world transforms + * updating the world transforms. The components are sorted in the breadth first + * order for each scene and grouped per scene. */ void ReorderComponents(); -- 2.7.4