Moved SetUpdate propagation to UpdateNodes 83/261583/1
authorDavid Steele <david.steele@samsung.com>
Wed, 21 Jul 2021 15:25:55 +0000 (16:25 +0100)
committerDavid Steele <david.steele@samsung.com>
Wed, 21 Jul 2021 15:25:55 +0000 (16:25 +0100)
Change-Id: I6c8f7be591e23a9fd776665d0fc074353fa027ee

dali/internal/render/common/render-manager.cpp
dali/internal/update/manager/render-task-processor.cpp
dali/internal/update/manager/update-algorithms.cpp
dali/internal/update/nodes/node.h

index 4a309fd..3f240a9 100644 (file)
 #include <dali/internal/render/common/render-instruction.h>
 #include <dali/internal/render/common/render-tracker.h>
 #include <dali/internal/render/queue/render-queue.h>
+#include <dali/internal/render/renderers/pipeline-cache.h>
 #include <dali/internal/render/renderers/render-frame-buffer.h>
 #include <dali/internal/render/renderers/render-texture.h>
 #include <dali/internal/render/renderers/shader-cache.h>
 #include <dali/internal/render/renderers/uniform-buffer-manager.h>
 #include <dali/internal/render/renderers/uniform-buffer-view-pool.h>
 #include <dali/internal/render/shaders/program-controller.h>
-#include <dali/internal/render/renderers/pipeline-cache.h>
 
 #include <memory>
 
@@ -125,7 +125,7 @@ struct RenderManager::Impl
     threadPool->Initialize(1u);
 
     uniformBufferManager = std::make_unique<Render::UniformBufferManager>(&graphicsController);
-    pipelineCache = std::make_unique<Render::PipelineCache>(graphicsController);
+    pipelineCache        = std::make_unique<Render::PipelineCache>(graphicsController);
   }
 
   ~Impl()
@@ -178,7 +178,7 @@ struct RenderManager::Impl
   Render::ShaderCache shaderCache;       ///< The cache for the graphics shaders
 
   std::unique_ptr<Render::UniformBufferManager> uniformBufferManager; ///< The uniform buffer manager
-  std::unique_ptr<Render::PipelineCache> pipelineCache;
+  std::unique_ptr<Render::PipelineCache>        pipelineCache;
 
   Integration::DepthBufferAvailable   depthBufferAvailable;   ///< Whether the depth buffer is available
   Integration::StencilBufferAvailable stencilBufferAvailable; ///< Whether the stencil buffer is available
@@ -224,8 +224,7 @@ void RenderManager::SetShaderSaver(ShaderSaver& upstream)
 void RenderManager::AddRenderer(OwnerPointer<Render::Renderer>& renderer)
 {
   // Initialize the renderer as we are now in render thread
-  renderer->Initialize(mImpl->graphicsController, mImpl->programController, mImpl->shaderCache, *(mImpl->uniformBufferManager.get()),
-                       *(mImpl->pipelineCache.get()));
+  renderer->Initialize(mImpl->graphicsController, mImpl->programController, mImpl->shaderCache, *(mImpl->uniformBufferManager.get()), *(mImpl->pipelineCache.get()));
 
   mImpl->rendererContainer.PushBack(renderer.Release());
 }
@@ -382,8 +381,7 @@ void RenderManager::AddGeometry(OwnerPointer<Render::Geometry>& geometry)
 
 void RenderManager::RemoveGeometry(Render::Geometry* geometry)
 {
-  auto it = std::find_if( mImpl->geometryContainer.begin(), mImpl->geometryContainer.end(),[geometry]( auto& item )
-  {
+  auto it = std::find_if(mImpl->geometryContainer.begin(), mImpl->geometryContainer.end(), [geometry](auto& item) {
     return geometry == item;
   });
 
@@ -469,7 +467,7 @@ void RenderManager::PreRender(Integration::RenderStatus& status, bool forceClear
     // Upload the geometries
     for(auto&& geom : mImpl->geometryContainer)
     {
-      geom->Upload( mImpl->graphicsController );
+      geom->Upload(mImpl->graphicsController);
     }
   }
 }
@@ -613,7 +611,7 @@ void RenderManager::PreRender(Integration::Scene& scene, std::vector<Rect<int>>&
                 (item.mNode->Updated() || (item.mRenderer && item.mRenderer->Updated(mImpl->renderBufferIndex, item.mNode)))))
             {
               item.mIsUpdated = false;
-              item.mNode->SetUpdated(false);
+              item.mNode->SetUpdatedTree(false);
 
               rect = item.CalculateViewportSpaceAABB(item.mUpdateSize, viewportRect.width, viewportRect.height);
               if(rect.IsValid() && rect.Intersect(viewportRect) && !rect.IsEmpty())
index db76d86..30d9257 100644 (file)
@@ -118,7 +118,7 @@ bool AddRenderablesForTask(BufferIndex updateBufferIndex,
   if(!node.GetPartialRenderingData().mVisible)
   {
     node.GetPartialRenderingData().mVisible = true;
-    node.SetUpdated(true);
+    node.SetUpdatedTree(true);
   }
 
   // Check whether node is exclusive to a different render-task
index b5975c0..db310df 100644 (file)
@@ -102,7 +102,8 @@ inline NodePropertyFlags UpdateNodes(Node&             node,
                                      BufferIndex       updateBufferIndex,
                                      RenderQueue&      renderQueue,
                                      Layer&            currentLayer,
-                                     uint32_t          inheritedDrawMode)
+                                     uint32_t          inheritedDrawMode,
+                                     bool              updated)
 {
   // Apply constraints to the node
   ConstrainPropertyOwner(node, updateBufferIndex);
@@ -141,6 +142,16 @@ inline NodePropertyFlags UpdateNodes(Node&             node,
     layer->SetReuseRenderers(updateBufferIndex, false);
   }
 
+  // For partial update, mark all children of an animating node as updated.
+  if(updated) // Only set to updated if parent was updated.
+  {
+    node.SetUpdated(true);
+  }
+  else if(node.Updated()) // Only propagate updated==true downwards.
+  {
+    updated = true;
+  }
+
   // recurse children
   NodeContainer& children = node.GetChildren();
   const NodeIter endIter  = children.End();
@@ -152,7 +163,8 @@ inline NodePropertyFlags UpdateNodes(Node&             node,
                                         updateBufferIndex,
                                         renderQueue,
                                         *layer,
-                                        inheritedDrawMode);
+                                        inheritedDrawMode,
+                                        updated);
   }
 
   return cumulativeDirtyFlags;
@@ -189,6 +201,8 @@ NodePropertyFlags UpdateNodeTree(Layer&       rootNode,
 
   DrawMode::Type drawMode(rootNode.GetDrawMode());
 
+  bool updated = rootNode.Updated();
+
   // recurse children
   NodeContainer& children = rootNode.GetChildren();
   const NodeIter endIter  = children.End();
@@ -200,7 +214,8 @@ NodePropertyFlags UpdateNodeTree(Layer&       rootNode,
                                         updateBufferIndex,
                                         renderQueue,
                                         rootNode,
-                                        drawMode);
+                                        drawMode,
+                                        updated);
   }
 
   return cumulativeDirtyFlags;
index b0a5818..d1fa90b 100644 (file)
@@ -122,13 +122,13 @@ public:
    * @param[in] updated The updated flag
    * (used for partial rendering to mark an animating sub tree for example).
    */
-  void SetUpdated(bool updated) override
+  void SetUpdatedTree(bool updated)
   {
     mUpdated = updated;
 
     for(Node* child : mChildren)
     {
-      child->SetUpdated(updated);
+      child->SetUpdatedTree(updated);
     }
   }