Fix the renderable visibility checking and its relationship with render once
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Thu, 27 Feb 2014 17:46:05 +0000 (17:46 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Mon, 3 Mar 2014 18:34:53 +0000 (18:34 +0000)
[Issue#] N/A
[Problem] incorrect algorithm
[Cause]
[Solution] fix the logic and clarify

Change-Id: I7114e35209f8a11d4f9e5c6aaa619b1744b20015

dali/internal/update/manager/process-render-tasks.cpp
dali/internal/update/node-attachments/scene-graph-renderable-attachment.cpp
dali/internal/update/node-attachments/scene-graph-renderable-attachment.h

index bc3683f9cbb1baddc5d7a8afc633be1fc85a667f..40c4f9cd9449f4e927454e12dc04be08e9a28cf8 100644 (file)
@@ -139,31 +139,38 @@ static bool AddRenderablesForTask( BufferIndex updateBufferIndex,
     RenderableAttachment* renderable = node.GetAttachment().GetRenderable(); // not all attachments render
     if ( renderable )
     {
-      bool ready = false;
-      bool complete = false;
-      renderable->GetReadyAndComplete(ready, complete);
+      bool visible = renderable->HasVisibleSizeAndColor();
+      // if its not potentially visible, then don't consider this renderable for render complete checking
+      // note that whilst visibility is inherited (if parent is insible, skip the sub-tree),
+      // size and color may not be so this needs to be done per renderable
+      if( visible ) // i.e. some resources are ready
+      {
+        bool ready = false;
+        bool complete = false;
+        renderable->GetReadyAndComplete(ready, complete);
 
-      DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "Testing renderable:%p ready:%s complete:%s\n", renderable, ready?"T":"F", complete?"T":"F");
+        DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "Testing renderable:%p ready:%s complete:%s\n", renderable, ready?"T":"F", complete?"T":"F");
 
-      resourcesFinished = !complete ? complete : resourcesFinished;
+        resourcesFinished = !complete ? complete : resourcesFinished;
 
-      if( ready ) // i.e. some resources are ready
-      {
-        if( DrawMode::STENCIL == inheritedDrawMode )
-        {
-          layer->stencilRenderables.push_back( renderable );
-        }
-        else if( DrawMode::OVERLAY == inheritedDrawMode )
-        {
-          layer->overlayRenderables.push_back( renderable );
-        }
-        else if ( ! renderable->IsBlendingOn( updateBufferIndex ) )
-        {
-          layer->opaqueRenderables.push_back( renderable );
-        }
-        else
+        if( ready ) // i.e. some resources are ready
         {
-          layer->transparentRenderables.push_back( renderable );
+          if( DrawMode::STENCIL == inheritedDrawMode )
+          {
+            layer->stencilRenderables.push_back( renderable );
+          }
+          else if( DrawMode::OVERLAY == inheritedDrawMode )
+          {
+            layer->overlayRenderables.push_back( renderable );
+          }
+          else if ( ! renderable->IsBlendingOn( updateBufferIndex ) )
+          {
+            layer->opaqueRenderables.push_back( renderable );
+          }
+          else
+          {
+            layer->transparentRenderables.push_back( renderable );
+          }
         }
       }
     }
index 0409a29f0f1beb3a1543a1924d2de3fe047eadbb..2610f3bdcbb98b1cf543e2077db1f0f028a7726e 100644 (file)
@@ -192,33 +192,30 @@ void RenderableAttachment::GetReadyAndComplete(bool& ready, bool& complete) cons
 
   CompleteStatusManager& completeStatusManager = mSceneController->GetCompleteStatusManager();
 
-  if( mHasSizeAndColorFlag )
+  std::size_t numTrackedResources = mTrackedResources.Count();
+  if( mHasUntrackedResources || numTrackedResources == 0 )
   {
-    std::size_t numTrackedResources = mTrackedResources.Count();
-    if( mHasUntrackedResources || numTrackedResources == 0 )
-    {
-      ready = mResourcesReady;
-      complete = mFinishedResourceAcquisition;
-    }
-    else
+    ready = mResourcesReady;
+    complete = mFinishedResourceAcquisition;
+  }
+  else
+  {
+    // If there are tracked resources and no untracked resources, test the trackers
+    ready = true;
+    for( size_t i=0; i < numTrackedResources; ++i )
     {
-      // If there are tracked resources and no untracked resources, test the trackers
-      ready = true;
-      for( size_t i=0; i < numTrackedResources; ++i )
+      ResourceTracker* tracker = completeStatusManager.FindResourceTracker(mTrackedResources[i]);
+      if( tracker && ! tracker->IsComplete() )
       {
-        ResourceTracker* tracker = completeStatusManager.FindResourceTracker(mTrackedResources[i]);
-        if( tracker && ! tracker->IsComplete() )
-        {
-          ready = false;
-          break;
-        }
+        ready = false;
+        break;
       }
+    }
 
-      complete = mFinishedResourceAcquisition;
-      if( ! complete )
-      {
-        complete = ready;
-      }
+    complete = mFinishedResourceAcquisition;
+    if( ! complete )
+    {
+      complete = ready;
     }
   }
 }
index f67d5af9dc495a69b2c1c19f20ebf376fc5c9ad8..b3bfe507a5f8e88a805d2be2b6f745b1ab55a628 100644 (file)
@@ -155,6 +155,15 @@ public: // For use during in the update algorithm only
     return mHasSizeAndColorFlag;
   }
 
+  /**
+   * if this renderable actor has visible size and color
+   * @return true if you can potentially see this actor
+   */
+  bool HasVisibleSizeAndColor() const
+  {
+    return mHasSizeAndColorFlag;
+  }
+
   /**
    * Check whether the attachment has been marked as ready to render
    * @param[out] ready TRUE if the attachment has resources to render