Process each RenderTask render-instruction separately 16/208816/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 28 Jun 2019 17:31:59 +0000 (18:31 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 8 Jul 2019 13:52:09 +0000 (14:52 +0100)
Change-Id: I099321d85caf404cf8e9da35e0e7e3c573b3a22d

automated-tests/src/dali/utc-Dali-Actor.cpp
automated-tests/src/dali/utc-Dali-Scene.cpp
dali/internal/update/manager/render-instruction-processor.cpp
dali/internal/update/manager/update-manager.cpp

index d578048..a208e2e 100644 (file)
@@ -7205,7 +7205,7 @@ int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
   TestApplication application;
   auto stage = Stage::GetCurrent();
 
-  tet_infoline( "Ensure we clear the screen when the last actor is removed" );
+  tet_infoline( "Ensure we clear the screen when the last actor is made invisible" );
 
   Actor actor = CreateRenderableActor();
   actor.SetSize( 100.0f, 100.0f );
index 5f9e9d2..45eee5c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -826,3 +826,48 @@ int UtcDaliSceneSignalWheelEventP(void)
   END_TEST;
 }
 
+int UtcDaliSceneEnsureEmptySceneCleared(void)
+{
+  tet_infoline( "Ensure we clear the newly added window" );
+
+  TestApplication application;
+
+  // Create a new scene and set the background colors of both the new and the main scenes
+  auto defaultScene = application.GetScene();
+  defaultScene.SetBackgroundColor( Color::WHITE );
+
+  auto newScene = Integration::Scene::New( Vector2( 480.0f, 800.0f ) );
+  newScene.SetBackgroundColor( Color::RED );
+
+  // Need to create a renderable as we don't start rendering until we have at least one
+  // We don't need to add this to any scene
+  auto actor = CreateRenderableActor();
+
+  auto& glAbstraction = application.GetGlAbstraction();
+  auto clearCountBefore = glAbstraction.GetClearCountCalled();
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 2, TEST_LOCATION );
+
+  // Add the actor to the main scene
+  defaultScene.Add( actor );
+
+  application.SendNotification();
+  application.Render();
+
+  // Add another scene and set its background color, ensure we clear it to the appropriate color
+
+  auto thirdScene = Integration::Scene::New( Vector2( 200.0f, 200.0f ) );
+  thirdScene.SetBackgroundColor( Color::BLUE );
+
+  clearCountBefore = glAbstraction.GetClearCountCalled();
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 3, TEST_LOCATION );
+
+  END_TEST;
+}
index d1c332c..204a472 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -408,6 +408,7 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex,
   renderTask.PrepareRenderInstruction( instruction, updateBufferIndex );
   bool viewMatrixHasNotChanged = !renderTask.ViewMatrixUpdated();
   bool isRenderListAdded = false;
+  bool isRootLayerDirty = false;
 
   const Matrix& viewMatrix = renderTask.GetViewMatrix( updateBufferIndex );
   SceneGraph::Camera& camera = renderTask.GetCamera();
@@ -420,6 +421,12 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex,
     const bool isLayer3D = layer.GetBehavior() == Dali::Layer::LAYER_3D;
     RenderList* renderList = NULL;
 
+    if( layer.IsRoot() && ( layer.GetDirtyFlags() != NodePropertyFlags::NOTHING ) )
+    {
+      // If root-layer & dirty, i.e. a property has changed or a child has been deleted, then we need to ensure we render once more
+      isRootLayerDirty = true;
+    }
+
     if( !layer.colorRenderables.Empty() )
     {
       RenderableContainer& renderables = layer.colorRenderables;
@@ -468,7 +475,7 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex,
   // Inform the render instruction that all renderers have been added and this frame is complete.
   instruction.UpdateCompleted();
 
-  if( !isRenderListAdded && !instruction.mIsClearColorSet )
+  if( !isRenderListAdded && !instruction.mIsClearColorSet && !isRootLayerDirty )
   {
     instructions.DiscardCurrentInstruction( updateBufferIndex );
   }
index ce5cfb8..852d5d4 100644 (file)
@@ -983,15 +983,6 @@ uint32_t UpdateManager::Update( float elapsedSeconds,
       DALI_LOG_INFO( gLogFilter, Debug::General,
                      "Update: numberOfRenderTasks(%d), Render Instructions(%d)\n",
                      numberOfRenderTasks, mImpl->renderInstructions.Count( bufferIndex ) );
-
-
-
-      // If any node is dirty, i.e. a property has changed or a child has been deleted, and we do not have any instructions to send, then generate a dummy instruction to force another render
-      if( ( mImpl->nodeDirtyFlags != NodePropertyFlags::NOTHING ) && ( mImpl->renderInstructions.Count( bufferIndex ) == 0 ) )
-      {
-        DALI_LOG_INFO( gLogFilter, Debug::General, "Node flags dirty, creating dummy instruction\n" );
-        mImpl->renderInstructions.GetNextInstruction( bufferIndex ); // This creates and adds an empty instruction. We do not need to modify it.
-      }
     }
   }