[4.0] Discard render instruction if it is empty
[platform/core/uifw/dali-core.git] / dali / internal / update / manager / render-instruction-processor.cpp
index b4035e8..b95706f 100644 (file)
@@ -400,6 +400,7 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex,
   RenderInstruction& instruction = instructions.GetNextInstruction( updateBufferIndex );
   renderTask.PrepareRenderInstruction( instruction, updateBufferIndex );
   bool viewMatrixHasNotChanged = !renderTask.ViewMatrixUpdated();
+  bool isRenderListAdded = false;
 
   const Matrix& viewMatrix = renderTask.GetViewMatrix( updateBufferIndex );
   SceneGraph::Camera& camera = renderTask.GetCamera();
@@ -430,6 +431,8 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex,
         // We only use the clipping version of the sort comparitor if any clipping nodes exist within the RenderList.
         SortRenderItems( updateBufferIndex, *renderList, layer, hasClippingNodes );
       }
+
+      isRenderListAdded = true;
     }
 
     if( !layer.overlayRenderables.Empty() )
@@ -450,13 +453,19 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex,
         // Clipping hierarchy is irrelevant when sorting overlay items, so we specify using the non-clipping version of the sort comparitor.
         SortRenderItems( updateBufferIndex, *renderList, layer, false );
       }
+
+      isRenderListAdded = true;
     }
   }
 
   // Inform the render instruction that all renderers have been added and this frame is complete.
   instruction.UpdateCompleted();
-}
 
+  if( !isRenderListAdded && !instruction.mIsClearColorSet )
+  {
+    instructions.DiscardCurrentInstruction( updateBufferIndex );
+  }
+}
 
 } // SceneGraph