Merge changes I8783ad29,I2c860a84 into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 17 Feb 2023 17:56:14 +0000 (17:56 +0000)
committerGerrit Code Review <gerrit@review>
Fri, 17 Feb 2023 17:56:14 +0000 (17:56 +0000)
* changes:
  Reducing message spam for baked properties
  AnimatableProperty Set/Bake now resets properly.

26 files changed:
automated-tests/src/dali-internal/utc-Dali-Internal-Handles.cpp
automated-tests/src/dali/utc-Dali-Actor.cpp
automated-tests/src/dali/utc-Dali-RenderTask.cpp
dali/internal/event/actors/camera-actor-impl.cpp
dali/internal/event/common/object-impl.cpp
dali/internal/event/render-tasks/render-task-impl.cpp
dali/internal/event/rendering/decorated-visual-renderer-impl.cpp
dali/internal/event/rendering/renderer-impl.cpp
dali/internal/event/rendering/visual-renderer-impl.cpp
dali/internal/update/animation/scene-graph-animator.h
dali/internal/update/common/animatable-property-messages.h [new file with mode: 0644]
dali/internal/update/common/animatable-property.h
dali/internal/update/common/double-buffered.h
dali/internal/update/common/property-resetter.h
dali/internal/update/manager/resetter-container.h [new file with mode: 0644]
dali/internal/update/manager/transform-manager-property.h
dali/internal/update/manager/update-manager.cpp
dali/internal/update/nodes/node-messages.h
dali/internal/update/nodes/partial-rendering-data.h
dali/internal/update/render-tasks/scene-graph-camera-messages.h [new file with mode: 0644]
dali/internal/update/render-tasks/scene-graph-camera.h
dali/internal/update/render-tasks/scene-graph-render-task-messages.h [new file with mode: 0644]
dali/internal/update/render-tasks/scene-graph-render-task.cpp
dali/internal/update/render-tasks/scene-graph-render-task.h
dali/internal/update/rendering/scene-graph-renderer-messages.h [new file with mode: 0644]
dali/internal/update/rendering/scene-graph-renderer.h

index 8c0a0ac..87d8fd0 100644 (file)
 
 #include <dali-test-suite-utils.h>
 #include <dali/public-api/dali-core.h>
-#include <stdlib.h>
+#include <mesh-builder.h>
 
+#include <stdlib.h>
 #include <iostream>
 
 // Internal headers are allowed here
+#include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
+#include <dali/internal/event/rendering/renderer-impl.h>
+#include <dali/internal/update/manager/update-manager.h>
+#include <dali/internal/update/rendering/scene-graph-renderer.h>
 
 using namespace Dali;
 
@@ -45,3 +50,124 @@ int UtcDaliCameraActorConstructorRefObject(void)
   DALI_TEST_CHECK(!actor);
   END_TEST;
 }
+
+namespace Impl
+{
+struct DerivedRenderer : public Dali::Internal::Renderer
+{
+  static IntrusivePtr<DerivedRenderer> New()
+  {
+    auto                          sceneObjectKey = Dali::Internal::SceneGraph::Renderer::NewKey();
+    IntrusivePtr<DerivedRenderer> impl           = new DerivedRenderer(sceneObjectKey.Get());
+
+    // transfer scene object ownership to update manager
+    Internal::EventThreadServices&       eventThreadServices = impl->GetEventThreadServices();
+    Internal::SceneGraph::UpdateManager& updateManager       = eventThreadServices.GetUpdateManager();
+    AddRendererMessage(updateManager, sceneObjectKey);
+    eventThreadServices.RegisterObject(impl.Get());
+    return impl;
+  }
+
+  DerivedRenderer(const Dali::Internal::SceneGraph::Renderer* sceneObject)
+  : Internal::Renderer(sceneObject)
+  {
+  }
+  ~DerivedRenderer()
+  {
+  }
+};
+} // namespace Impl
+
+struct DerivedRenderer : public Renderer
+{
+  static DerivedRenderer New(Geometry geometry, Shader shader)
+  {
+    IntrusivePtr<Impl::DerivedRenderer> impl = Impl::DerivedRenderer::New();
+    impl->SetGeometry(GetImplementation(geometry));
+    impl->SetShader(GetImplementation(shader));
+    DerivedRenderer custom(impl.Get());
+    return custom;
+  }
+  DerivedRenderer()  = default;
+  ~DerivedRenderer() = default;
+  DerivedRenderer(Impl::DerivedRenderer* impl)
+  : Renderer(impl)
+  {
+  }
+};
+
+int UtcDaliInternalHandleRendererPropertyComponents(void)
+{
+  TestApplication application;
+
+  Dali::TypeRegistration typeRegistration(typeid(DerivedRenderer), typeid(Dali::Renderer), nullptr);
+
+  Shader   shader   = Shader::New("VertexSource", "FragmentSource");
+  Geometry geometry = CreateQuadGeometry();
+  auto     derived  = DerivedRenderer::New(geometry, shader);
+  Actor    actor    = Actor::New();
+  actor.AddRenderer(derived);
+  application.GetScene().Add(actor);
+
+  const Property::Index foobarIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+  const Property::Index fooIndex    = foobarIndex + 1;
+  const Property::Index barIndex    = foobarIndex + 2;
+
+  const Property::Index rgbIndex   = foobarIndex + 3;
+  const Property::Index redIndex   = rgbIndex + 1;
+  const Property::Index greenIndex = rgbIndex + 2;
+  const Property::Index blueIndex  = rgbIndex + 3;
+
+  const Property::Index rgbaIndex   = rgbIndex + 4;
+  const Property::Index red2Index   = rgbaIndex + 1;
+  const Property::Index green2Index = rgbaIndex + 2;
+  const Property::Index blue2Index  = rgbaIndex + 3;
+  const Property::Index alphaIndex  = rgbaIndex + 4;
+
+  // If we don't properly register a scene graph property for the "parent" type,
+  // then Object::GetSceneGraphProperty registers a float type for the child...
+
+  AnimatablePropertyRegistration(typeRegistration, "Foobar", foobarIndex, Vector2(10.0f, 20.0f));
+  AnimatablePropertyComponentRegistration(typeRegistration, "Foobar.x", fooIndex, foobarIndex, 0);
+  AnimatablePropertyComponentRegistration(typeRegistration, "Foobar.y", barIndex, foobarIndex, 1);
+
+  AnimatablePropertyRegistration(typeRegistration, "RGB", rgbIndex, Vector3(0.5f, 0.5, 1.0f));
+  AnimatablePropertyComponentRegistration(typeRegistration, "RGB.red", redIndex, rgbIndex, 0);
+  AnimatablePropertyComponentRegistration(typeRegistration, "RGB.green", greenIndex, rgbIndex, 1);
+  AnimatablePropertyComponentRegistration(typeRegistration, "RGB.blue", blueIndex, rgbIndex, 2);
+
+  AnimatablePropertyRegistration(typeRegistration, "RGBA", rgbaIndex, Vector4(0.5f, 0.5, 1.0f, 1.0f));
+  AnimatablePropertyComponentRegistration(typeRegistration, "RGBA.red", red2Index, rgbaIndex, 0);
+  AnimatablePropertyComponentRegistration(typeRegistration, "RGBA.green", green2Index, rgbaIndex, 1);
+  AnimatablePropertyComponentRegistration(typeRegistration, "RGBA.blue", blue2Index, rgbaIndex, 2);
+  AnimatablePropertyComponentRegistration(typeRegistration, "RGBA.alpha", alphaIndex, rgbaIndex, 3);
+
+  derived.SetProperty(foobarIndex, Vector2(9.0f, 10.0f));
+  derived.SetProperty(fooIndex, 100.0f);
+  derived.SetProperty(barIndex, 200.0f);
+
+  derived.SetProperty(rgbIndex, Vector3(0.9f, 0.9f, 0.1f));
+  derived.SetProperty(redIndex, 1.0f);
+  derived.SetProperty(greenIndex, 1.0f);
+  derived.SetProperty(blueIndex, 1.0f);
+
+  derived.SetProperty(rgbaIndex, Color::WHITE * 0.5f);
+  derived.SetProperty(red2Index, Color::SEA_GREEN.r);
+  derived.SetProperty(green2Index, Color::SEA_GREEN.g);
+  derived.SetProperty(blue2Index, Color::SEA_GREEN.b);
+  derived.SetProperty(alphaIndex, Color::SEA_GREEN.a);
+
+  application.SendNotification();
+  application.Render(16);
+
+  Vector2 foobar = derived.GetCurrentProperty<Vector2>(foobarIndex);
+  DALI_TEST_EQUALS(foobar, Vector2(100.0f, 200.0f), 0.0001f, TEST_LOCATION);
+
+  Vector3 colour = derived.GetCurrentProperty<Vector3>(rgbIndex);
+  DALI_TEST_EQUALS(colour, Vector3(1.0f, 1.0f, 1.0f), 0.0001f, TEST_LOCATION);
+
+  Vector4 col2 = derived.GetCurrentProperty<Vector4>(rgbaIndex);
+  DALI_TEST_EQUALS(col2, Color::SEA_GREEN, 0.0001f, TEST_LOCATION);
+
+  END_TEST;
+}
index 92a7a0a..4413115 100644 (file)
@@ -11887,8 +11887,9 @@ int UtcDaliActorCalculateWorldColor01(void)
   branchActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
   leafActor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
 
-  rootActor[Actor::Property::COLOR]   = Color::WHITE;
-  branchActor[Actor::Property::COLOR] = Vector4(1.0f, 1.0f, 0.5f, 0.8f);
+  rootActor[Actor::Property::COLOR] = Color::WHITE;
+  Vector4 testColor1(1.0f, 1.0f, 0.5f, 0.8f);
+  branchActor[Actor::Property::COLOR] = testColor1;
   leafActor[Actor::Property::COLOR]   = Vector4(0.1f, 0.5f, 0.5f, 0.8f);
 
   // Default is to inherit:
@@ -11899,9 +11900,21 @@ int UtcDaliActorCalculateWorldColor01(void)
   branchActor.Add(leafActor);
 
   application.SendNotification();
-  application.Render(0);
+  application.Render(16);
+  Vector4 color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
+  DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
 
-  Vector4 color = DevelActor::GetWorldColor(leafActor);
+  application.SendNotification();
+  application.Render(16);
+  color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
+  DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render(16);
+  color = branchActor.GetCurrentProperty<Vector4>(Actor::Property::COLOR);
+  DALI_TEST_EQUALS(color, testColor1, TEST_LOCATION);
+
+  color = DevelActor::GetWorldColor(leafActor);
 
   Vector4 actualColor = leafActor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR);
   DALI_TEST_EQUALS(color, actualColor, 0.001f, TEST_LOCATION);
index af93507..cbdee4a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -3685,6 +3685,210 @@ int UtcDaliRenderTaskViewportGuideActor02(void)
   END_TEST;
 }
 
+int UtcDaliRenderTaskViewportGuideActor03(void)
+{
+  TestApplication application(
+    TestApplication::DEFAULT_SURFACE_WIDTH,
+    TestApplication::DEFAULT_SURFACE_HEIGHT,
+    TestApplication::DEFAULT_HORIZONTAL_DPI,
+    TestApplication::DEFAULT_VERTICAL_DPI,
+    true,
+    true);
+
+  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+  TraceCallStack&    callStack     = glAbstraction.GetViewportTrace();
+  glAbstraction.EnableViewportCallTrace(true);
+  tet_infoline("Testing that adding a viewport guide actor to RenderTask will change the viewport");
+
+  Stage   stage = Stage::GetCurrent();
+  Vector2 stageSize(stage.GetSize());
+
+  // Render and notify
+  application.SendNotification();
+  application.Render(16);
+  glAbstraction.ResetViewportCallStack();
+
+  Geometry geometry = Geometry::New();
+  Shader   shader   = Shader::New("vertexSrc", "fragmentSrc");
+  Renderer renderer = Renderer::New(geometry, shader);
+
+  Actor blue                                 = Actor::New();
+  blue[Dali::Actor::Property::NAME]          = "Blue";
+  blue[Dali::Actor::Property::ANCHOR_POINT]  = AnchorPoint::TOP_LEFT;
+  blue[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+  blue[Dali::Actor::Property::SIZE]          = Vector2(400, 300);
+  blue[Dali::Actor::Property::POSITION]      = Vector2(100, 50);
+  blue.AddRenderer(renderer);
+  stage.Add(blue);
+
+  Actor green                                 = Actor::New();
+  green[Dali::Actor::Property::NAME]          = "Green";
+  green[Dali::Actor::Property::ANCHOR_POINT]  = AnchorPoint::TOP_LEFT;
+  green[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+  green[Dali::Actor::Property::SIZE]          = Vector2(400, 300);
+  green[Dali::Actor::Property::POSITION]      = Vector2(100, 50);
+  green.AddRenderer(renderer);
+  stage.Add(green);
+
+  RenderTaskList renderTaskList = stage.GetRenderTaskList();
+  RenderTask     renderTask     = renderTaskList.CreateTask();
+
+  Dali::CameraActor cameraActor                     = Dali::CameraActor::New(stageSize);
+  cameraActor[Dali::Actor::Property::ANCHOR_POINT]  = AnchorPoint::CENTER;
+  cameraActor[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+  stage.Add(cameraActor);
+
+  renderTask.SetExclusive(true);
+  renderTask.SetInputEnabled(true);
+  renderTask.SetCameraActor(cameraActor);
+  renderTask.SetSourceActor(green);
+
+  Viewport viewport(75, 55, 150, 250);
+  renderTask.SetViewport(viewport);
+
+  // Render and notify
+  application.SendNotification();
+  application.Render(16);
+
+  // Note Y pos: 800 - (250+55) = 495
+  std::string viewportParams1("75, 495, 150, 250");
+  DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams1) >= 0);
+  glAbstraction.ResetViewportCallStack();
+
+  // Update to use viewport guide actor instead.
+  renderTask.SetViewportGuideActor(blue);
+
+  // Render and notify
+  application.SendNotification();
+  application.Render(16);
+
+  // Note: Y pos: 800 - (300+50) = 450
+  std::string viewportParams2("100, 450, 400, 300");
+  DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams2) >= 0);
+  tet_infoline("Testing that removing viewport guide actor from RenderTask will revert the viewport");
+  glAbstraction.ResetViewportCallStack();
+
+  // Remove guide actor, expect that the viewport is reset to its original values
+  renderTask.SetViewportGuideActor(Actor());
+  application.SendNotification();
+  application.Render(16);
+
+  // Currently, update manager does not consider that added Resetters should cause another
+  // update; this is probably right. But, we have to then force another update for the resetter to trigger, and this will register as un-necessary in the test output.
+  //
+  application.SendNotification();
+  application.Render(16);
+
+  DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams1) >= 0);
+
+  END_TEST;
+}
+
+int UtcDaliRenderTaskViewportGuideActor04(void)
+{
+  TestApplication application(
+    TestApplication::DEFAULT_SURFACE_WIDTH,
+    TestApplication::DEFAULT_SURFACE_HEIGHT,
+    TestApplication::DEFAULT_HORIZONTAL_DPI,
+    TestApplication::DEFAULT_VERTICAL_DPI,
+    true,
+    true);
+
+  TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+  TraceCallStack&    callStack     = glAbstraction.GetViewportTrace();
+  glAbstraction.EnableViewportCallTrace(true);
+  tet_infoline("Testing that adding a viewport guide actor to RenderTask will change the viewport");
+
+  Stage   stage = Stage::GetCurrent();
+  Vector2 stageSize(stage.GetSize());
+
+  // Render and notify
+  application.SendNotification();
+  application.Render(16);
+  glAbstraction.ResetViewportCallStack();
+
+  Geometry geometry = Geometry::New();
+  Shader   shader   = Shader::New("vertexSrc", "fragmentSrc");
+  Renderer renderer = Renderer::New(geometry, shader);
+
+  Actor blue                                 = Actor::New();
+  blue[Dali::Actor::Property::NAME]          = "Blue";
+  blue[Dali::Actor::Property::ANCHOR_POINT]  = AnchorPoint::TOP_LEFT;
+  blue[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+  blue[Dali::Actor::Property::SIZE]          = Vector2(400, 300);
+  blue[Dali::Actor::Property::POSITION]      = Vector2(100, 50);
+  blue.AddRenderer(renderer);
+  stage.Add(blue);
+
+  Actor green                                 = Actor::New();
+  green[Dali::Actor::Property::NAME]          = "Green";
+  green[Dali::Actor::Property::ANCHOR_POINT]  = AnchorPoint::TOP_LEFT;
+  green[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::TOP_LEFT;
+  green[Dali::Actor::Property::SIZE]          = Vector2(400, 300);
+  green[Dali::Actor::Property::POSITION]      = Vector2(100, 50);
+  green.AddRenderer(renderer);
+  stage.Add(green);
+
+  RenderTaskList renderTaskList = stage.GetRenderTaskList();
+  RenderTask     renderTask     = renderTaskList.CreateTask();
+
+  Dali::CameraActor cameraActor                     = Dali::CameraActor::New(stageSize);
+  cameraActor[Dali::Actor::Property::ANCHOR_POINT]  = AnchorPoint::CENTER;
+  cameraActor[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+  stage.Add(cameraActor);
+
+  renderTask.SetExclusive(true);
+  renderTask.SetInputEnabled(true);
+  renderTask.SetCameraActor(cameraActor);
+  renderTask.SetSourceActor(green);
+
+  Viewport viewport(75, 55, 150, 250);
+  renderTask.SetViewport(viewport);
+
+  // Render and notify
+  application.SendNotification();
+  application.Render(16);
+
+  // Note Y pos: 800 - (250+55) = 495
+  std::string viewportParams1("75, 495, 150, 250");
+  DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams1) >= 0);
+  glAbstraction.ResetViewportCallStack();
+
+  // Update to use viewport guide actor instead.
+  renderTask.SetViewportGuideActor(blue);
+
+  // Render and notify
+  application.SendNotification();
+  application.Render(16);
+
+  std::string viewportParams2("100, 450, 400, 300");
+  DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams2) >= 0);
+  tet_infoline("Testing that removing viewport guide actor from RenderTask will revert the viewport");
+
+  glAbstraction.ResetViewportCallStack();
+
+  // Remove guide actor, expect that the viewport is reset to it's original values
+  renderTask.ResetViewportGuideActor();
+  application.SendNotification();
+  application.Render(16);
+
+  // Currently, update manager does not consider that added Resetters should cause another
+  // update; this is probably right. But, we have to then force another update for the resetter
+  // to trigger, and this will register as un-necessary in the test output.
+  application.SendNotification();
+  application.Render(16);
+
+  DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams1) >= 0);
+
+  // This should remove the baking resetters, but is again going to show up
+  // as unnecessary. Also try and figure out if we can test the dirty flags
+  // here, somehow (Can at least check the property's dirty flags in the debugger).
+  application.SendNotification();
+  application.Render(16);
+
+  END_TEST;
+}
+
 int UtcDaliRenderTaskSetPartialUpdate(void)
 {
   TestApplication application(
index f714d74..beefc38 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <dali/internal/update/common/property-base.h>
 #include <dali/internal/update/manager/update-manager.h>
+#include <dali/internal/update/render-tasks/scene-graph-camera-messages.h>
 
 namespace Dali
 {
index da251d7..ce584da 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -36,6 +36,8 @@
 #include <dali/internal/update/common/property-owner.h>
 #include <dali/internal/update/common/uniform-map.h>
 
+#include <dali/internal/update/common/animatable-property-messages.h>
+
 using Dali::Internal::SceneGraph::AnimatableProperty;
 using Dali::Internal::SceneGraph::PropertyBase;
 
@@ -1464,7 +1466,7 @@ void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG(property);
 
       // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<bool>(GetEventThreadServices(), *property, value.Get<bool>());
+      BakeMessage<bool>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<bool>());
       break;
     }
 
@@ -1474,7 +1476,7 @@ void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG(property);
 
       // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<int32_t>(GetEventThreadServices(), *property, value.Get<int32_t>());
+      BakeMessage<int32_t>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<int32_t>());
       break;
     }
 
@@ -1484,7 +1486,7 @@ void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG(property);
 
       // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<float>(GetEventThreadServices(), *property, value.Get<float>());
+      BakeMessage<float>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       break;
     }
 
@@ -1496,15 +1498,15 @@ void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata
       // property is being used in a separate thread; queue a message to set the property
       if(entry.componentIndex == 0)
       {
-        SetXComponentMessage<Vector2>(GetEventThreadServices(), *property, value.Get<float>());
+        SetXComponentMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       }
       else if(entry.componentIndex == 1)
       {
-        SetYComponentMessage<Vector2>(GetEventThreadServices(), *property, value.Get<float>());
+        SetYComponentMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       }
       else
       {
-        BakeMessage<Vector2>(GetEventThreadServices(), *property, value.Get<Vector2>());
+        BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<Vector2>());
       }
       break;
     }
@@ -1517,19 +1519,19 @@ void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata
       // property is being used in a separate thread; queue a message to set the property
       if(entry.componentIndex == 0)
       {
-        SetXComponentMessage<Vector3>(GetEventThreadServices(), *property, value.Get<float>());
+        SetXComponentMessage<Vector3>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       }
       else if(entry.componentIndex == 1)
       {
-        SetYComponentMessage<Vector3>(GetEventThreadServices(), *property, value.Get<float>());
+        SetYComponentMessage<Vector3>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       }
       else if(entry.componentIndex == 2)
       {
-        SetZComponentMessage<Vector3>(GetEventThreadServices(), *property, value.Get<float>());
+        SetZComponentMessage<Vector3>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       }
       else
       {
-        BakeMessage<Vector3>(GetEventThreadServices(), *property, value.Get<Vector3>());
+        BakeMessage<Vector3>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<Vector3>());
       }
 
       break;
@@ -1543,23 +1545,23 @@ void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata
       // property is being used in a separate thread; queue a message to set the property
       if(entry.componentIndex == 0)
       {
-        SetXComponentMessage<Vector4>(GetEventThreadServices(), *property, value.Get<float>());
+        SetXComponentMessage<Vector4>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       }
       else if(entry.componentIndex == 1)
       {
-        SetYComponentMessage<Vector4>(GetEventThreadServices(), *property, value.Get<float>());
+        SetYComponentMessage<Vector4>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       }
       else if(entry.componentIndex == 2)
       {
-        SetZComponentMessage<Vector4>(GetEventThreadServices(), *property, value.Get<float>());
+        SetZComponentMessage<Vector4>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       }
       else if(entry.componentIndex == 3)
       {
-        SetWComponentMessage<Vector4>(GetEventThreadServices(), *property, value.Get<float>());
+        SetWComponentMessage<Vector4>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<float>());
       }
       else
       {
-        BakeMessage<Vector4>(GetEventThreadServices(), *property, value.Get<Vector4>());
+        BakeMessage<Vector4>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<Vector4>());
       }
       break;
     }
@@ -1570,7 +1572,7 @@ void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG(property);
 
       // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<Quaternion>(GetEventThreadServices(), *property, value.Get<Quaternion>());
+      BakeMessage<Quaternion>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<Quaternion>());
       break;
     }
 
@@ -1580,7 +1582,7 @@ void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG(property);
 
       // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<Matrix>(GetEventThreadServices(), *property, value.Get<Matrix>());
+      BakeMessage<Matrix>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<Matrix>());
       break;
     }
 
@@ -1590,7 +1592,7 @@ void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG(property);
 
       // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<Matrix3>(GetEventThreadServices(), *property, value.Get<Matrix3>());
+      BakeMessage<Matrix3>(GetEventThreadServices(), *mUpdateObject, *property, value.Get<Matrix3>());
       break;
     }
 
index d0032dd..cac0ab8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -30,7 +30,9 @@
 #include <dali/internal/event/common/scene-impl.h>
 #include <dali/internal/event/common/stage-impl.h>
 #include <dali/internal/event/render-tasks/render-task-list-impl.h>
+#include <dali/internal/update/common/animatable-property-messages.h>
 #include <dali/internal/update/nodes/node.h>
+#include <dali/internal/update/render-tasks/scene-graph-render-task-messages.h>
 #include <dali/internal/update/render-tasks/scene-graph-render-task.h>
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/object/type-registry.h>
@@ -210,13 +212,32 @@ Dali::Actor RenderTask::GetScreenToFrameBufferMappingActor() const
 void RenderTask::SetViewportGuideActor(Actor* actor)
 {
   mViewportGuideActor.SetActor(actor);
+
+  auto& sceneObject         = GetRenderTaskSceneObject();
+  auto& eventThreadServices = GetEventThreadServices();
+  auto& updateManager       = eventThreadServices.GetUpdateManager();
+
   if(actor)
   {
-    SetViewportGuideNodeMessage(GetEventThreadServices(), GetRenderTaskSceneObject(), &actor->GetNode());
+    SetViewportGuideNodeMessage(eventThreadServices, sceneObject, &actor->GetNode());
   }
   else
   {
-    SetViewportGuideNodeMessage(GetEventThreadServices(), GetRenderTaskSceneObject(), nullptr);
+    // Ensure that if the node is removed through this API, that the
+    // viewport values are set back to their base value and that their dirty
+    // flags are cleared after 1 frame.
+    SetViewportGuideNodeMessage(eventThreadServices, sceneObject, nullptr);
+
+    auto renderTask               = const_cast<SceneGraph::RenderTask*>(&sceneObject);
+    auto viewportPositionProperty = const_cast<SceneGraph::AnimatableProperty<Vector2>*>(&renderTask->mViewportPosition);
+    auto viewportSizeProperty     = const_cast<SceneGraph::AnimatableProperty<Vector2>*>(&renderTask->mViewportSize);
+
+    OwnerPointer<SceneGraph::PropertyResetterBase> resetter1(
+      new SceneGraph::BakerResetter(renderTask, viewportPositionProperty, SceneGraph::BakerResetter::Lifetime::SET));
+    OwnerPointer<SceneGraph::PropertyResetterBase> resetter2(
+      new SceneGraph::BakerResetter(renderTask, viewportSizeProperty, SceneGraph::BakerResetter::Lifetime::SET));
+    AddResetterMessage(updateManager, resetter1);
+    AddResetterMessage(updateManager, resetter2);
   }
 }
 
@@ -227,17 +248,26 @@ Actor* RenderTask::GetViewportGuideActor() const
 
 void RenderTask::ResetViewportGuideActor()
 {
-  SetViewportGuideActor(nullptr);
+  // Don't re-use the SetViewportGuideActor method for this task - the bake messages below will create their own resetters.
+  mViewportGuideActor.SetActor(nullptr);
+  SetViewportGuideNodeMessage(GetEventThreadServices(), GetRenderTaskSceneObject(), nullptr);
 
-  BakeViewportPositionMessage(GetEventThreadServices(), GetRenderTaskSceneObject(), mViewportPosition);
-  BakeViewportSizeMessage(GetEventThreadServices(), GetRenderTaskSceneObject(), mViewportSize);
+  EventThreadServices& eventThreadServices      = GetEventThreadServices();
+  auto                 renderTask               = const_cast<SceneGraph::RenderTask*>(&GetRenderTaskSceneObject());
+  auto                 viewportPositionProperty = const_cast<SceneGraph::AnimatableProperty<Vector2>*>(&renderTask->mViewportPosition);
+  auto                 viewportSizeProperty     = const_cast<SceneGraph::AnimatableProperty<Vector2>*>(&renderTask->mViewportSize);
+  BakeMessage<Vector2>(eventThreadServices, *renderTask, *viewportPositionProperty, mViewportPosition);
+  BakeMessage<Vector2>(eventThreadServices, *renderTask, *viewportSizeProperty, mViewportSize);
 }
 
 void RenderTask::SetViewportPosition(const Vector2& value)
 {
   mViewportPosition = value;
 
-  BakeViewportPositionMessage(GetEventThreadServices(), GetRenderTaskSceneObject(), value);
+  EventThreadServices& eventThreadServices      = GetEventThreadServices();
+  auto                 renderTask               = const_cast<SceneGraph::RenderTask*>(&GetRenderTaskSceneObject());
+  auto                 viewportPositionProperty = const_cast<SceneGraph::AnimatableProperty<Vector2>*>(&renderTask->mViewportPosition);
+  BakeMessage<Vector2>(eventThreadServices, *renderTask, *viewportPositionProperty, mViewportPosition);
 }
 
 Vector2 RenderTask::GetCurrentViewportPosition() const
@@ -249,7 +279,10 @@ void RenderTask::SetViewportSize(const Vector2& value)
 {
   mViewportSize = value;
 
-  BakeViewportSizeMessage(GetEventThreadServices(), GetRenderTaskSceneObject(), value);
+  EventThreadServices& eventThreadServices  = GetEventThreadServices();
+  auto                 renderTask           = const_cast<SceneGraph::RenderTask*>(&GetRenderTaskSceneObject());
+  auto                 viewportSizeProperty = const_cast<SceneGraph::AnimatableProperty<Vector2>*>(&renderTask->mViewportSize);
+  BakeMessage<Vector2>(eventThreadServices, *renderTask, *viewportSizeProperty, mViewportSize);
 }
 
 Vector2 RenderTask::GetCurrentViewportSize() const
@@ -303,7 +336,10 @@ void RenderTask::SetClearColor(const Vector4& color)
     mClearColor = color;
 
     // scene object is being used in a separate thread; queue a message to set the value
-    BakeClearColorMessage(GetEventThreadServices(), GetRenderTaskSceneObject(), color);
+    EventThreadServices& eventThreadServices = GetEventThreadServices();
+    auto                 renderTask          = const_cast<SceneGraph::RenderTask*>(&GetRenderTaskSceneObject());
+    auto                 clearColorProperty  = const_cast<SceneGraph::AnimatableProperty<Vector4>*>(&renderTask->mClearColor);
+    BakeMessage<Vector4>(eventThreadServices, *renderTask, *clearColorProperty, mClearColor);
   }
 }
 
index ee879f1..f68862d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -23,6 +23,8 @@
 #include <dali/devel-api/scripting/scripting.h>
 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
 #include <dali/internal/event/common/property-input-impl.h>
+#include <dali/internal/update/common/animatable-property-messages.h>
+#include <dali/internal/update/common/property-owner.h>
 #include <dali/internal/update/manager/update-manager.h>
 #include <dali/internal/update/rendering/scene-graph-renderer.h>
 #include <dali/public-api/object/type-registry.h>
@@ -61,11 +63,11 @@ TypeRegistration mType(typeid(Dali::DecoratedVisualRenderer), typeid(Dali::Visua
  * @param animatableProperty The animatable property to set on the update-thread
  */
 template<typename T>
-void SetValue(EventThreadServices& eventThreadServices, const Property::Value& propertyValue, T& cachedValue, const SceneGraph::AnimatableProperty<T>& animatableProperty)
+void SetValue(EventThreadServices& eventThreadServices, const SceneGraph::PropertyOwner& propertyOwner, const Property::Value& propertyValue, T& cachedValue, const SceneGraph::AnimatableProperty<T>& animatableProperty)
 {
   if(propertyValue.Get(cachedValue))
   {
-    BakeMessage<T>(eventThreadServices, animatableProperty, cachedValue);
+    BakeMessage<T>(eventThreadServices, propertyOwner, animatableProperty, cachedValue);
   }
 }
 
@@ -131,37 +133,37 @@ void DecoratedVisualRenderer::SetDefaultProperty(Property::Index        index,
         {
           case Dali::DecoratedVisualRenderer::Property::CORNER_RADIUS:
           {
-            SetValue(eventThreadServices, propertyValue, mDecoratedPropertyCache.mCornerRadius, decoratedVisualProperties->mCornerRadius);
+            SetValue(eventThreadServices, *mUpdateObject, propertyValue, mDecoratedPropertyCache.mCornerRadius, decoratedVisualProperties->mCornerRadius);
             break;
           }
 
           case Dali::DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY:
           {
-            SetValue(eventThreadServices, propertyValue, mDecoratedPropertyCache.mCornerRadiusPolicy, decoratedVisualProperties->mCornerRadiusPolicy);
+            SetValue(eventThreadServices, *mUpdateObject, propertyValue, mDecoratedPropertyCache.mCornerRadiusPolicy, decoratedVisualProperties->mCornerRadiusPolicy);
             break;
           }
 
           case Dali::DecoratedVisualRenderer::Property::BORDERLINE_WIDTH:
           {
-            SetValue(eventThreadServices, propertyValue, mDecoratedPropertyCache.mBorderlineWidth, decoratedVisualProperties->mBorderlineWidth);
+            SetValue(eventThreadServices, *mUpdateObject, propertyValue, mDecoratedPropertyCache.mBorderlineWidth, decoratedVisualProperties->mBorderlineWidth);
             break;
           }
 
           case Dali::DecoratedVisualRenderer::Property::BORDERLINE_COLOR:
           {
-            SetValue(eventThreadServices, propertyValue, mDecoratedPropertyCache.mBorderlineColor, decoratedVisualProperties->mBorderlineColor);
+            SetValue(eventThreadServices, *mUpdateObject, propertyValue, mDecoratedPropertyCache.mBorderlineColor, decoratedVisualProperties->mBorderlineColor);
             break;
           }
 
           case Dali::DecoratedVisualRenderer::Property::BORDERLINE_OFFSET:
           {
-            SetValue(eventThreadServices, propertyValue, mDecoratedPropertyCache.mBorderlineOffset, decoratedVisualProperties->mBorderlineOffset);
+            SetValue(eventThreadServices, *mUpdateObject, propertyValue, mDecoratedPropertyCache.mBorderlineOffset, decoratedVisualProperties->mBorderlineOffset);
             break;
           }
 
           case Dali::DecoratedVisualRenderer::Property::BLUR_RADIUS:
           {
-            SetValue(eventThreadServices, propertyValue, mDecoratedPropertyCache.mBlurRadius, decoratedVisualProperties->mBlurRadius);
+            SetValue(eventThreadServices, *mUpdateObject, propertyValue, mDecoratedPropertyCache.mBlurRadius, decoratedVisualProperties->mBlurRadius);
             break;
           }
         }
index ace6e68..0865182 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -24,6 +24,7 @@
 #include <dali/internal/event/common/property-input-impl.h>
 #include <dali/internal/render/renderers/render-geometry.h>
 #include <dali/internal/update/manager/update-manager.h>
+#include <dali/internal/update/rendering/scene-graph-renderer-messages.h>
 #include <dali/internal/update/rendering/scene-graph-renderer.h>
 #include <dali/public-api/object/type-registry.h>
 
@@ -663,8 +664,9 @@ void Renderer::SetDefaultProperty(Property::Index        index,
       {
         if(!Equals(mOpacity, opacity))
         {
-          mOpacity = opacity;
-          BakeOpacityMessage(GetEventThreadServices(), GetRendererSceneObject(), mOpacity);
+          mOpacity         = opacity;
+          auto sceneObject = const_cast<SceneGraph::Renderer*>(&GetRendererSceneObject());
+          SceneGraph::BakeOpacityMessage(GetEventThreadServices(), *sceneObject, mOpacity);
         }
       }
       break;
index 9c8f008..62a78ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -23,6 +23,7 @@
 #include <dali/devel-api/scripting/scripting.h>
 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
 #include <dali/internal/event/common/property-input-impl.h>
+#include <dali/internal/update/common/animatable-property-messages.h>
 #include <dali/internal/update/manager/update-manager.h>
 #include <dali/internal/update/rendering/scene-graph-renderer.h>
 #include <dali/public-api/object/type-registry.h>
@@ -119,7 +120,7 @@ void VisualRenderer::SetDefaultProperty(Property::Index        index,
 
           if(visualProperties)
           {
-            BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mTransformOffset, mPropertyCache.mTransformOffset);
+            BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformOffset, mPropertyCache.mTransformOffset);
           }
         }
         break;
@@ -133,7 +134,7 @@ void VisualRenderer::SetDefaultProperty(Property::Index        index,
           auto                        visualProperties = sceneObject.GetVisualProperties();
           if(visualProperties)
           {
-            BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mTransformSize, mPropertyCache.mTransformSize);
+            BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformSize, mPropertyCache.mTransformSize);
           }
         }
         break;
@@ -146,7 +147,7 @@ void VisualRenderer::SetDefaultProperty(Property::Index        index,
           auto                        visualProperties = sceneObject.GetVisualProperties();
           if(visualProperties)
           {
-            BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mTransformOrigin, mPropertyCache.mTransformOrigin);
+            BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformOrigin, mPropertyCache.mTransformOrigin);
           }
         }
         break;
@@ -159,7 +160,7 @@ void VisualRenderer::SetDefaultProperty(Property::Index        index,
           auto                        visualProperties = sceneObject.GetVisualProperties();
           if(visualProperties)
           {
-            BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mTransformAnchorPoint, mPropertyCache.mTransformAnchorPoint);
+            BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformAnchorPoint, mPropertyCache.mTransformAnchorPoint);
           }
         }
         break;
@@ -172,7 +173,7 @@ void VisualRenderer::SetDefaultProperty(Property::Index        index,
           auto                        visualProperties = sceneObject.GetVisualProperties();
           if(visualProperties)
           {
-            BakeMessage<Vector4>(GetEventThreadServices(), visualProperties->mTransformOffsetSizeMode, mPropertyCache.mTransformOffsetSizeMode);
+            BakeMessage<Vector4>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformOffsetSizeMode, mPropertyCache.mTransformOffsetSizeMode);
           }
         }
         break;
@@ -185,7 +186,7 @@ void VisualRenderer::SetDefaultProperty(Property::Index        index,
           auto                        visualProperties = sceneObject.GetVisualProperties();
           if(visualProperties)
           {
-            BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mExtraSize, mPropertyCache.mExtraSize);
+            BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mExtraSize, mPropertyCache.mExtraSize);
           }
         }
         break;
@@ -198,7 +199,7 @@ void VisualRenderer::SetDefaultProperty(Property::Index        index,
           auto                        visualProperties = sceneObject.GetVisualProperties();
           if(visualProperties)
           {
-            BakeMessage<Vector3>(GetEventThreadServices(), visualProperties->mMixColor, mPropertyCache.mMixColor);
+            BakeMessage<Vector3>(GetEventThreadServices(), *mUpdateObject, visualProperties->mMixColor, mPropertyCache.mMixColor);
           }
         }
         break;
@@ -215,7 +216,7 @@ void VisualRenderer::SetDefaultProperty(Property::Index        index,
             if(visualProperties)
             {
               mPropertyCache.mPreMultipliedAlpha = preMultipliedAlpha;
-              BakeMessage<float>(GetEventThreadServices(), visualProperties->mPreMultipliedAlpha, preMultipliedAlpha);
+              BakeMessage<float>(GetEventThreadServices(), *mUpdateObject, visualProperties->mPreMultipliedAlpha, preMultipliedAlpha);
             }
           }
         }
index 7be4a13..391bacf 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_ANIMATOR_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
 #include <functional>
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/common/owner-container.h>
-#include <dali/integration-api/debug.h>
 #include <dali/internal/event/animation/key-frames-impl.h>
 #include <dali/internal/event/animation/path-impl.h>
 #include <dali/internal/update/animation/property-accessor.h>
 #include <dali/internal/update/common/property-base.h>
-#include <dali/internal/update/nodes/node.h>
+#include <dali/internal/update/common/property-owner.h>
 #include <dali/public-api/animation/alpha-function.h>
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/animation/time-period.h>
diff --git a/dali/internal/update/common/animatable-property-messages.h b/dali/internal/update/common/animatable-property-messages.h
new file mode 100644 (file)
index 0000000..e18a3fd
--- /dev/null
@@ -0,0 +1,212 @@
+#ifndef DALI_INTERNAL_COMMON_ANIMATABLE_PROPERTY_MESSAGES_H
+#define DALI_INTERNAL_COMMON_ANIMATABLE_PROPERTY_MESSAGES_H
+
+/*
+ * Copyright (c) 2023 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/internal/common/message.h>
+#include <dali/internal/event/common/event-thread-services.h>
+#include <dali/internal/update/common/animatable-property.h>
+#include <dali/internal/update/common/property-owner.h>
+#include <dali/internal/update/common/property-resetter.h>
+#include <dali/internal/update/manager/update-manager.h>
+
+namespace Dali::Internal
+{
+
+/**
+ * Special message to first bake a property, then create a resetter for the
+ * property in the update thread to reduce load on event thread.
+ * @tparam T The type of the property
+ * @tparam P2 The type of the parameter to the second object method
+ */
+template<class T, typename P>
+class MessageBakeReset : public MessageBase
+{
+public:
+  using MemberFunction = void (T::*)(BufferIndex, typename ParameterType<P>::PassingType);
+
+  /**
+   * Create a message.
+   * @note The object is expected to be const in the thread which sends this message.
+   * However it can be modified when Process() is called in a different thread.
+   * @param[in] updateManager
+   * @param[in] propertyOwner The owner of the property
+   * @param[in] property The property to update
+   * @param[in] member The member function of the property object (bake/set)
+   * @param[in] p The value to update the property to
+   */
+  MessageBakeReset(SceneGraph::UpdateManager&             updateManager,
+                   const SceneGraph::PropertyOwner&       propertyOwner,
+                   const T*                               property,
+                   MemberFunction                         member,
+                   typename ParameterType<P>::PassingType p)
+  : MessageBase(),
+    mUpdateManager(updateManager),
+    mPropertyOwner(propertyOwner),
+    object(const_cast<T*>(property)),
+    memberFunction(member),
+    param(p)
+  {
+    DALI_ASSERT_DEBUG(property && "nullptr passed into message as property");
+  }
+
+  /**
+   * Virtual destructor
+   */
+  ~MessageBakeReset() override = default;
+
+  /**
+   * @copydoc MessageBase::Process
+   */
+  void Process(BufferIndex bufferIndex) override
+  {
+    // Bake/set the property
+    (object->*memberFunction)(bufferIndex, param);
+
+    // Create the resetter in the Update thread.
+    OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+      new SceneGraph::BakerResetter(const_cast<SceneGraph::PropertyOwner*>(&mPropertyOwner),
+                                    object,
+                                    SceneGraph::BakerResetter::Lifetime::BAKE));
+    mUpdateManager.AddPropertyResetter(resetter);
+  }
+
+private:
+  SceneGraph::UpdateManager&            mUpdateManager;
+  const SceneGraph::PropertyOwner&      mPropertyOwner;
+  T*                                    object;
+  MemberFunction                        memberFunction;
+  typename ParameterType<P>::HolderType param;
+};
+
+template<typename T>
+void BakeMessage(EventThreadServices&                     eventThreadServices,
+                 const SceneGraph::PropertyOwner&         propertyOwner,
+                 const SceneGraph::AnimatableProperty<T>& property,
+                 typename ParameterType<T>::PassingType   newValue)
+{
+  using LocalType = MessageBakeReset<SceneGraph::AnimatableProperty<T>, T>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(eventThreadServices.GetUpdateManager(),
+                      propertyOwner,
+                      &property,
+                      &SceneGraph::AnimatableProperty<T>::Bake,
+                      newValue);
+}
+
+template<class T>
+void BakeRelativeMessage(EventThreadServices&                     eventThreadServices,
+                         const SceneGraph::PropertyOwner&         propertyOwner,
+                         const SceneGraph::AnimatableProperty<T>& property,
+                         const T&                                 delta)
+{
+  using LocalType = MessageBakeReset<SceneGraph::AnimatableProperty<T>, T>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(eventThreadServices.GetUpdateManager(),
+                      propertyOwner,
+                      &property,
+                      &SceneGraph::AnimatableProperty<T>::BakeRelative,
+                      delta);
+}
+
+template<class T>
+void SetXComponentMessage(EventThreadServices&                       eventThreadServices,
+                          const SceneGraph::PropertyOwner&           propertyOwner,
+                          const SceneGraph::AnimatableProperty<T>&   property,
+                          typename ParameterType<float>::PassingType newValue)
+{
+  using LocalType = MessageBakeReset<SceneGraph::AnimatableProperty<T>, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(eventThreadServices.GetUpdateManager(),
+                      propertyOwner,
+                      &property,
+                      &SceneGraph::AnimatableProperty<T>::BakeX,
+                      newValue);
+}
+
+template<class T>
+void SetYComponentMessage(EventThreadServices&                       eventThreadServices,
+                          const SceneGraph::PropertyOwner&           propertyOwner,
+                          const SceneGraph::AnimatableProperty<T>&   property,
+                          typename ParameterType<float>::PassingType newValue)
+{
+  using LocalType = MessageBakeReset<SceneGraph::AnimatableProperty<T>, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(eventThreadServices.GetUpdateManager(),
+                      propertyOwner,
+                      &property,
+                      &SceneGraph::AnimatableProperty<T>::BakeY,
+                      newValue);
+}
+
+template<class T>
+void SetZComponentMessage(EventThreadServices&                       eventThreadServices,
+                          const SceneGraph::PropertyOwner&           propertyOwner,
+                          const SceneGraph::AnimatableProperty<T>&   property,
+                          typename ParameterType<float>::PassingType newValue)
+{
+  using LocalType = MessageBakeReset<SceneGraph::AnimatableProperty<T>, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(eventThreadServices.GetUpdateManager(),
+                      propertyOwner,
+                      &property,
+                      &SceneGraph::AnimatableProperty<T>::BakeZ,
+                      newValue);
+}
+
+template<class T>
+void SetWComponentMessage(EventThreadServices&                       eventThreadServices,
+                          const SceneGraph::PropertyOwner&           propertyOwner,
+                          const SceneGraph::AnimatableProperty<T>&   property,
+                          typename ParameterType<float>::PassingType newValue)
+{
+  using LocalType = MessageBakeReset<SceneGraph::AnimatableProperty<T>, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(eventThreadServices.GetUpdateManager(),
+                      propertyOwner,
+                      &property,
+                      &SceneGraph::AnimatableProperty<T>::BakeW,
+                      newValue);
+}
+
+} // namespace Dali::Internal
+
+#endif // DALI_INTERNAL_COMMON_ANIMATABLE_PROPERTY_MESSAGES_H
index 7bc5831..949fec7 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_ANIMATABLE_PROPERTY_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
 
 // INTERNAL INCLUDES
 #include <dali/internal/common/matrix-utils.h>
-#include <dali/internal/common/message.h>
-#include <dali/internal/event/common/event-thread-services.h>
-#include <dali/internal/event/common/property-input-impl.h>
+
 #include <dali/internal/update/common/double-buffered.h>
 #include <dali/internal/update/common/property-base.h>
-#include <dali/internal/update/common/scene-graph-buffers.h>
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/object/property-input.h>
 #include <dali/public-api/object/property-types.h>
@@ -2074,104 +2071,6 @@ private:
 
 } // namespace SceneGraph
 
-// Messages for AnimatableProperty<T>
-
-template<class T>
-void BakeMessage(EventThreadServices&                     eventThreadServices,
-                 const SceneGraph::AnimatableProperty<T>& property,
-                 typename ParameterType<T>::PassingType   newValue)
-{
-  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, T>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&property,
-                      &SceneGraph::AnimatableProperty<T>::Bake,
-                      newValue);
-}
-
-template<class T>
-void BakeRelativeMessage(EventThreadServices&                     eventThreadServices,
-                         const SceneGraph::AnimatableProperty<T>& property,
-                         const T&                                 delta)
-{
-  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, const T&>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&property,
-                      &SceneGraph::AnimatableProperty<T>::BakeRelative,
-                      delta);
-}
-
-template<class T>
-void SetXComponentMessage(EventThreadServices&                       eventThreadServices,
-                          const SceneGraph::AnimatableProperty<T>&   property,
-                          typename ParameterType<float>::PassingType newValue)
-{
-  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&property,
-                      &SceneGraph::AnimatableProperty<T>::BakeX,
-                      newValue);
-}
-
-template<class T>
-void SetYComponentMessage(EventThreadServices&                       eventThreadServices,
-                          const SceneGraph::AnimatableProperty<T>&   property,
-                          typename ParameterType<float>::PassingType newValue)
-{
-  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&property,
-                      &SceneGraph::AnimatableProperty<T>::BakeY,
-                      newValue);
-}
-
-template<class T>
-void SetZComponentMessage(EventThreadServices&                       eventThreadServices,
-                          const SceneGraph::AnimatableProperty<T>&   property,
-                          typename ParameterType<float>::PassingType newValue)
-{
-  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&property,
-                      &SceneGraph::AnimatableProperty<T>::BakeZ,
-                      newValue);
-}
-
-template<class T>
-void SetWComponentMessage(EventThreadServices&                       eventThreadServices,
-                          const SceneGraph::AnimatableProperty<T>&   property,
-                          typename ParameterType<float>::PassingType newValue)
-{
-  using LocalType = MessageDoubleBuffered1<SceneGraph::AnimatableProperty<T>, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&property,
-                      &SceneGraph::AnimatableProperty<T>::BakeW,
-                      newValue);
-}
-
 } // namespace Internal
 
 } // namespace Dali
index 53a5cad..65f7cd6 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_DOUBLE_BUFFERED_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -19,6 +19,7 @@
  */
 
 // INTERNAL INCLUDES
+#include <dali/internal/common/buffer-index.h>
 #include <dali/internal/common/owner-pointer.h>
 
 namespace Dali
index 5be8ca2..ddbc110 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENEGRAPH_PROPERTY_RESETTER_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -66,7 +66,7 @@ public:
    * Reset the property to it's base value if the property owner is still alive and on stage
    * @param[in] updateBufferIndex the current buffer index
    */
-  void ResetToBaseValue(BufferIndex updateBufferIndex)
+  virtual void ResetToBaseValue(BufferIndex updateBufferIndex)
   {
     if(mPropertyOwner != nullptr && mActive)
     {
@@ -131,15 +131,9 @@ public:
    */
   virtual bool IsFinished()
   {
-    bool finished = mRunning <= STOPPED;
-    if(mRunning == AGING)
-    {
-      mRunning = STOPPED;
-    }
-    return finished;
+    return mRunning <= STOPPED;
   }
 
-protected:
   enum
   {
     STOPPED = 0,
@@ -147,6 +141,7 @@ protected:
     ACTIVE  = 2,
   };
 
+protected:
   /**
    * Constructor
    *
@@ -170,6 +165,65 @@ protected:
   bool           mDisconnected;  ///< True if the property owner has been disconnected
 };
 
+class BakerResetter : public PropertyResetterBase
+{
+public:
+  enum class Lifetime
+  {
+    BAKE,
+    SET
+  };
+
+  /**
+   * New method.
+   * @param[in] propertyOwner  The owner of the property
+   * @param[in] baseProperty   The property being animated
+   * @param[in] lifetime       How long this resetter stays alive (1 or 2 frames)
+   * @return the new property resetter
+   */
+  static PropertyResetterBase* New(const PropertyOwner& propertyOwner,
+                                   const PropertyBase&  baseProperty,
+                                   Lifetime             lifetime)
+  {
+    return new BakerResetter(const_cast<PropertyOwner*>(&propertyOwner),
+                             const_cast<PropertyBase*>(&baseProperty),
+                             lifetime);
+  }
+
+  /**
+   * Constructor
+   * @param[in] propertyOwner The owner of the property
+   * @param[in] baseProperty  The property being animated
+   * @param[in] lifetime      How many frames this stays alive for
+   */
+  BakerResetter(PropertyOwner* propertyOwner,
+                PropertyBase*  baseProperty,
+                Lifetime       lifetime)
+  : PropertyResetterBase(propertyOwner, baseProperty)
+  {
+    mRunning = lifetime == Lifetime::BAKE ? ACTIVE : AGING;
+  }
+
+  /**
+   * Virtual destructor.
+   */
+  ~BakerResetter() override = default;
+
+  /**
+   * @param updateBufferIndex
+   */
+  void ResetToBaseValue(BufferIndex updateBufferIndex) override
+  {
+    if(mPropertyOwner && mRunning > 0)
+    {
+      mRunning--;
+      mBaseProperty->ResetToBaseValue(updateBufferIndex);
+
+      // @todo Consider adding mPropertyOwner->SetUpdated(true) here.
+    }
+  }
+};
+
 /**
  * Specialization of Resetter based on templated modifier type (either Constraint or Animator)
  */
diff --git a/dali/internal/update/manager/resetter-container.h b/dali/internal/update/manager/resetter-container.h
new file mode 100644 (file)
index 0000000..9c042b1
--- /dev/null
@@ -0,0 +1,183 @@
+#ifndef DALI_INTERNAL_UPDATE_RESETTER_CONTAINER_H
+#define DALI_INTERNAL_UPDATE_RESETTER_CONTAINER_H
+
+/*
+ * Copyright (c) 2023 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Dali::Internal::SceneGraph
+{
+
+/**
+ * Template class to manage node/property resetters
+ */
+template<class ResetterType>
+class ResetterContainer
+{
+public:
+  // std::list offers fast delete and fast iteration.
+  using ContainerType = std::list<ResetterType*>;
+  using Iterator      = typename ContainerType::iterator;
+  using ConstIterator = typename ContainerType::const_iterator;
+
+  ResetterContainer() = default;
+
+  ResetterContainer(const ResetterContainer&) = delete;
+  ResetterContainer(ResetterContainer&&)      = delete;
+
+  /**
+   * Ensure all resetters are destroyed when the container is destroyed
+   */
+  ~ResetterContainer()
+  {
+    Clear();
+  }
+
+  /**
+   * Add a resetter to the container
+   * @param[in] resetterPtr A pointer to the resetter.
+   * The container takes ownership.
+   */
+  void PushBack(ResetterType* resetterPtr)
+  {
+    mContainer.push_back(resetterPtr);
+  }
+
+  /**
+   * @return true if the container is empty
+   */
+  bool Empty()
+  {
+    return mContainer.empty();
+  }
+
+  /**
+   * Clear the container, destroying all extant resetters.
+   */
+  void Clear()
+  {
+    auto iter = Begin();
+    while(iter != End())
+    {
+      iter = EraseObject(iter);
+    }
+  }
+
+  /**
+   * @return an iterator to the start of the container
+   */
+  Iterator Begin()
+  {
+    return mContainer.begin();
+  }
+  /**
+   * Support for C++11 Range-based for loop
+   * @return an iterator to the start of the container.
+   */
+  Iterator begin()
+  {
+    return mContainer.begin();
+  }
+  /**
+   * @return an iterator to the start of the container
+   */
+  ConstIterator Begin() const
+  {
+    return mContainer.begin();
+  }
+  /**
+   * Support for C++11 Range-based for loop
+   * @return an iterator to the start of the container.
+   */
+  ConstIterator begin() const
+  {
+    return mContainer.begin();
+  }
+
+  /**
+   * @return an iterator to the end of the container.
+   */
+  Iterator End()
+  {
+    return mContainer.end();
+  }
+  /**
+   * Support for C++11 Range-based for loop
+   * @return an iterator to the end of the container.
+   */
+  Iterator end()
+  {
+    return mContainer.end();
+  }
+  /**
+   * @return an iterator to the end of the container.
+   */
+  ConstIterator End() const
+  {
+    return mContainer.end();
+  }
+  /**
+   * Support for C++11 Range-based for loop
+   * @return an iterator to the end of the container.
+   */
+  ConstIterator end() const
+  {
+    return mContainer.end();
+  }
+
+  /**
+   * Erase a resetter from the container
+   */
+  Iterator EraseObject(Iterator iter)
+  {
+    delete *iter;
+    return mContainer.erase(iter);
+  }
+
+  /**
+   * Iterate over the container, resetting all the referenced
+   * properties. If a resetter has finished (e.g. it's animation /
+   * constraint has ended, or it's baked 2 values), then it is removed
+   * from the list.
+   * @param[in] bufferIndex The buffer index of the property to be reset
+   */
+  void ResetToBaseValues(BufferIndex bufferIndex)
+  {
+    if(!mContainer.empty())
+    {
+      auto end  = mContainer.end();
+      auto iter = mContainer.begin();
+      while(iter != end)
+      {
+        (*iter)->ResetToBaseValue(bufferIndex);
+        if((*iter)->IsFinished())
+        {
+          iter = EraseObject(iter);
+        }
+        else // Skip to next element
+        {
+          ++iter;
+        }
+      }
+    }
+  }
+
+private:
+  ContainerType mContainer; ///< The list of resetters
+};
+
+} // namespace Dali::Internal::SceneGraph
+
+#endif // DALI_INTERNAL_UPDATE_RESETTER_CONTAINER_H
index 3c11242..b9600bd 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef TRANSFORM_MANAGER_PROPERTY_H_
-#define TRANSFORM_MANAGER_PROPERTY_H_
+#ifndef DALI_INTERNAL_UPDATE_TRANSFORM_MANAGER_PROPERTY_H
+#define DALI_INTERNAL_UPDATE_TRANSFORM_MANAGER_PROPERTY_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -463,7 +463,7 @@ public:
   }
 
 private:
-  TransformManagerVector3Input(const TransformManagerVector3Input& property)       = delete;
+  TransformManagerVector3Input(const TransformManagerVector3Input& property) = delete;
   TransformManagerVector3Input& operator=(const TransformManagerVector3Input& rhs) = delete;
 
 public:
@@ -603,7 +603,7 @@ public:
   }
 
 private:
-  TransformManagerQuaternionInput(const TransformManagerQuaternionInput& property)       = delete;
+  TransformManagerQuaternionInput(const TransformManagerQuaternionInput& property) = delete;
   TransformManagerQuaternionInput& operator=(const TransformManagerQuaternionInput& rhs) = delete;
 
 public:
@@ -736,7 +736,7 @@ public:
   }
 
 private:
-  TransformManagerMatrixInput(const TransformManagerMatrixInput& property)       = delete;
+  TransformManagerMatrixInput(const TransformManagerMatrixInput& property) = delete;
   TransformManagerMatrixInput& operator=(const TransformManagerMatrixInput& rhs) = delete;
 };
 
@@ -744,4 +744,4 @@ private:
 } // namespace Internal
 } // namespace Dali
 
-#endif // TRANSFORM_MANAGER_PROPERTY_H_
+#endif // DALI_INTERNAL_UPDATE_TRANSFORM_MANAGER_PROPERTY_H
index 72304ef..184573b 100644 (file)
@@ -33,6 +33,7 @@
 #include <dali/internal/update/controllers/scene-controller-impl.h>
 #include <dali/internal/update/manager/frame-callback-processor.h>
 #include <dali/internal/update/manager/render-task-processor.h>
+#include <dali/internal/update/manager/resetter-container.h>
 #include <dali/internal/update/manager/transform-manager.h>
 #include <dali/internal/update/manager/update-algorithms.h>
 #include <dali/internal/update/manager/update-manager-debug.h>
@@ -145,11 +146,11 @@ struct UpdateManager::Impl
     {
     }
 
-    ~SceneInfo()               = default;                ///< Default non-virtual destructor
-    SceneInfo(SceneInfo&& rhs) = default;                ///< Move constructor
-    SceneInfo& operator=(SceneInfo&& rhs) = default;     ///< Move assignment operator
-    SceneInfo& operator=(const SceneInfo& rhs) = delete; ///< Assignment operator
-    SceneInfo(const SceneInfo& rhs)            = delete; ///< Copy constructor
+    ~SceneInfo()                               = default; ///< Default non-virtual destructor
+    SceneInfo(SceneInfo&& rhs)                 = default; ///< Move constructor
+    SceneInfo& operator=(SceneInfo&& rhs)      = default; ///< Move assignment operator
+    SceneInfo& operator=(const SceneInfo& rhs) = delete;  ///< Assignment operator
+    SceneInfo(const SceneInfo& rhs)            = delete;  ///< Copy constructor
 
     Layer*                       root{nullptr};   ///< Root node (root is a layer). The layer is not stored in the node memory pool.
     OwnerPointer<RenderTaskList> taskList;        ///< Scene graph render task list
@@ -278,13 +279,14 @@ struct UpdateManager::Impl
 
   OwnerContainer<PropertyOwner*> customObjects; ///< A container of owned objects (with custom properties)
 
-  OwnerContainer<PropertyResetterBase*> propertyResetters;     ///< A container of property resetters
-  OwnerContainer<NodeResetter*>         nodeResetters;         ///< A container of node resetters
-  OwnerContainer<Animation*>            animations;            ///< A container of owned animations
-  PropertyNotificationContainer         propertyNotifications; ///< A container of owner property notifications.
-  OwnerKeyContainer<Renderer>           renderers;             ///< A container of owned renderers
-  OwnerContainer<TextureSet*>           textureSets;           ///< A container of owned texture sets
-  OwnerContainer<Shader*>               shaders;               ///< A container of owned shaders
+  ResetterContainer<PropertyResetterBase> propertyResetters; ///< A container of property resetters
+  ResetterContainer<NodeResetter>         nodeResetters;     ///< A container of node resetters
+
+  OwnerContainer<Animation*>    animations;            ///< A container of owned animations
+  PropertyNotificationContainer propertyNotifications; ///< A container of owner property notifications.
+  OwnerKeyContainer<Renderer>   renderers;             ///< A container of owned renderers
+  OwnerContainer<TextureSet*>   textureSets;           ///< A container of owned texture sets
+  OwnerContainer<Shader*>       shaders;               ///< A container of owned shaders
 
   DiscardQueue<Node*, OwnerContainer<Node*>>                         nodeDiscardQueue; ///< Nodes are added here when disconnected from the scene-graph.
   DiscardQueue<Shader*, OwnerContainer<Shader*>>                     shaderDiscardQueue;
@@ -348,7 +350,8 @@ void UpdateManager::InstallRoot(OwnerPointer<Layer>& layer)
 
   Layer* rootLayer = layer.Release();
 
-  DALI_ASSERT_DEBUG(std::find_if(mImpl->scenes.begin(), mImpl->scenes.end(), [rootLayer](Impl::SceneInfoPtr& scene) { return scene && scene->root == rootLayer; }) == mImpl->scenes.end() &&
+  DALI_ASSERT_DEBUG(std::find_if(mImpl->scenes.begin(), mImpl->scenes.end(), [rootLayer](Impl::SceneInfoPtr& scene)
+                                 { return scene && scene->root == rootLayer; }) == mImpl->scenes.end() &&
                     "Root Node already installed");
 
   rootLayer->CreateTransform(&mImpl->transformManager);
@@ -731,38 +734,10 @@ void UpdateManager::ResetProperties(BufferIndex bufferIndex)
   mImpl->animationFinishedDuringUpdate = false;
 
   // Reset node properties
-  std::vector<NodeResetter*> nodeResetterToDelete;
-  for(auto&& element : mImpl->nodeResetters)
-  {
-    element->ResetToBaseValue(bufferIndex);
-    if(element->IsFinished())
-    {
-      nodeResetterToDelete.push_back(element);
-    }
-  }
-
-  // If a node resetter is no longer required, delete it.
-  for(auto&& elementPtr : nodeResetterToDelete)
-  {
-    mImpl->nodeResetters.EraseObject(elementPtr);
-  }
+  mImpl->nodeResetters.ResetToBaseValues(bufferIndex);
 
   // Reset all animating / constrained properties
-  std::vector<PropertyResetterBase*> propertyResettertoDelete;
-  for(auto&& element : mImpl->propertyResetters)
-  {
-    element->ResetToBaseValue(bufferIndex);
-    if(element->IsFinished())
-    {
-      propertyResettertoDelete.push_back(element);
-    }
-  }
-
-  // If a property resetter is no longer required (the animator or constraint has been removed), delete it.
-  for(auto&& elementPtr : propertyResettertoDelete)
-  {
-    mImpl->propertyResetters.EraseObject(elementPtr);
-  }
+  mImpl->propertyResetters.ResetToBaseValues(bufferIndex);
 
   // Clear all root nodes dirty flags
   for(auto& scene : mImpl->scenes)
@@ -1273,7 +1248,8 @@ void UpdateManager::SetDepthIndices(OwnerPointer<NodeDepths>& nodeDepths)
     {
       // Reorder children container only if sibiling order changed.
       NodeContainer& container = node->GetChildren();
-      std::sort(container.Begin(), container.End(), [](Node* a, Node* b) { return a->GetDepthIndex() < b->GetDepthIndex(); });
+      std::sort(container.Begin(), container.End(), [](Node* a, Node* b)
+                { return a->GetDepthIndex() < b->GetDepthIndex(); });
     }
   }
 }
index a866119..340559e 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -82,8 +82,17 @@ public:
     // Reserve some memory inside the message queue
     uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(NodePropertyMessage));
 
+    auto& updateManager = eventThreadServices.GetUpdateManager();
+
     // Construct message in the message queue memory; note that delete should not be called on the return value
-    new(slot) NodePropertyMessage(eventThreadServices.GetUpdateManager(), node, property, member, value);
+    new(slot) NodePropertyMessage(updateManager, node, property, member, value);
+
+    // Non-transform property doesn't get reset. Add a resetter.
+    OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+      new SceneGraph::BakerResetter(const_cast<Node*>(node),
+                                    const_cast<AnimatableProperty<P>*>(property),
+                                    BakerResetter::Lifetime::BAKE));
+    AddResetterMessage(updateManager, resetter);
   }
 
   /**
@@ -158,8 +167,17 @@ public:
     // Reserve some memory inside the message queue
     uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(NodePropertyComponentMessage));
 
+    auto& updateManager = eventThreadServices.GetUpdateManager();
+
     // Construct message in the message queue memory; note that delete should not be called on the return value
-    new(slot) NodePropertyComponentMessage(eventThreadServices.GetUpdateManager(), node, property, member, value);
+    new(slot) NodePropertyComponentMessage(updateManager, node, property, member, value);
+
+    // Non-transform property doesn't get reset. Add a resetter.
+    OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+      new SceneGraph::BakerResetter(const_cast<Node*>(node),
+                                    const_cast<AnimatableProperty<P>*>(property),
+                                    BakerResetter::Lifetime::BAKE));
+    AddResetterMessage(updateManager, resetter);
   }
 
   /**
index 5d7f943..c099b03 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_PARTIAL_RENDERING_DATA_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  * limitations under the License.
  */
 
-#include <dali/internal/update/rendering/scene-graph-renderer.h>
 #include <dali/public-api/math/matrix.h>
 #include <dali/public-api/math/vector3.h>
 #include <dali/public-api/math/vector4.h>
 
 namespace Dali::Internal::SceneGraph
 {
-class Node;
-class TextureSet;
-
 /**
  * Structure contains partial rendering data used in order to determine
  * whether anything has changed and node has to be updated
diff --git a/dali/internal/update/render-tasks/scene-graph-camera-messages.h b/dali/internal/update/render-tasks/scene-graph-camera-messages.h
new file mode 100644 (file)
index 0000000..5ff3e8d
--- /dev/null
@@ -0,0 +1,196 @@
+#ifndef DALI_INTERNAL_SCENE_GRAPH_CAMERA_MESSAGES_H
+#define DALI_INTERNAL_SCENE_GRAPH_CAMERA_MESSAGES_H
+
+/*
+ * Copyright (c) 2023 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/internal/common/message.h>
+#include <dali/internal/common/type-abstraction-enums.h>
+#include <dali/internal/event/common/event-thread-services.h>
+#include <dali/internal/update/manager/update-manager.h>
+#include <dali/internal/update/render-tasks/scene-graph-camera.h>
+
+namespace Dali::Internal
+{
+// value types used by messages
+template<>
+struct ParameterType<Dali::Camera::Type>
+: public BasicType<Dali::Camera::Type>
+{
+};
+
+template<>
+struct ParameterType<Dali::Camera::ProjectionMode>
+: public BasicType<Dali::Camera::ProjectionMode>
+{
+};
+
+namespace SceneGraph
+{
+inline void SetTypeMessage(EventThreadServices& eventThreadServices, const Camera& camera, Dali::Camera::Type parameter)
+{
+  using LocalType = MessageValue1<Camera, Dali::Camera::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::SetType, parameter);
+}
+
+inline void SetProjectionModeMessage(EventThreadServices& eventThreadServices, const Camera& camera, Dali::Camera::ProjectionMode parameter)
+{
+  using LocalProjectionMode = MessageValue1<Camera, Dali::Camera::ProjectionMode>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalProjectionMode));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalProjectionMode(&camera, &Camera::SetProjectionMode, parameter);
+}
+
+inline void SetProjectionDirectionMessage(EventThreadServices& eventThreadServices, const Camera& camera, Dali::DevelCameraActor::ProjectionDirection parameter)
+{
+  using LocalProjectionDirection = MessageValue1<Camera, Dali::DevelCameraActor::ProjectionDirection>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalProjectionDirection));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalProjectionDirection(&camera, &Camera::SetProjectionDirection, parameter);
+}
+
+inline void BakeFieldOfViewMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
+{
+  using LocalType = MessageDoubleBuffered1<Camera, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::BakeFieldOfView, parameter);
+
+  OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+    new SceneGraph::BakerResetter(const_cast<SceneGraph::Camera*>(&camera),
+                                  const_cast<SceneGraph::AnimatableProperty<float>*>(&camera.mFieldOfView),
+                                  BakerResetter::Lifetime::BAKE));
+  AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+inline void BakeOrthographicSizeMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
+{
+  using LocalType = MessageDoubleBuffered1<Camera, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::BakeOrthographicSize, parameter);
+
+  OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+    new SceneGraph::BakerResetter(const_cast<SceneGraph::Camera*>(&camera),
+                                  const_cast<SceneGraph::AnimatableProperty<float>*>(&camera.mOrthographicSize),
+                                  BakerResetter::Lifetime::BAKE));
+  AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+inline void BakeAspectRatioMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
+{
+  using LocalType = MessageDoubleBuffered1<Camera, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::BakeAspectRatio, parameter);
+
+  OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+    new SceneGraph::BakerResetter(const_cast<SceneGraph::Camera*>(&camera),
+                                  const_cast<SceneGraph::AnimatableProperty<float>*>(&camera.mAspectRatio),
+                                  BakerResetter::Lifetime::BAKE));
+  AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+inline void SetNearClippingPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
+{
+  using LocalType = MessageValue1<Camera, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::SetNearClippingPlane, parameter);
+}
+
+inline void SetFarClippingPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
+{
+  using LocalType = MessageValue1<Camera, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::SetFarClippingPlane, parameter);
+}
+
+inline void SetReflectByPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, const Vector4& plane)
+{
+  using LocalType = MessageValue1<Camera, Vector4>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::SetReflectByPlane, plane);
+}
+
+inline void SetTargetPositionMessage(EventThreadServices& eventThreadServices, const Camera& camera, const Vector3& parameter)
+{
+  using LocalType = MessageValue1<Camera, Vector3>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::SetTargetPosition, parameter);
+}
+
+inline void SetInvertYAxisMessage(EventThreadServices& eventThreadServices, const Camera& camera, bool parameter)
+{
+  using LocalType = MessageValue1<Camera, bool>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::SetInvertYAxis, parameter);
+}
+
+inline void RotateProjectionMessage(EventThreadServices& eventThreadServices, const Camera& camera, int parameter)
+{
+  typedef MessageValue1<Camera, int> LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&camera, &Camera::RotateProjection, parameter);
+}
+
+} // namespace SceneGraph
+} // namespace Dali::Internal
+
+#endif //DALI_INTERNAL_SCENE_GRAPH_CAMERA_MESSAGES_H
index 278d765..e779f49 100644 (file)
@@ -20,9 +20,6 @@
 
 // INTERNAL INCLUDES
 #include <dali/devel-api/actors/camera-actor-devel.h>
-#include <dali/internal/common/message.h>
-#include <dali/internal/common/type-abstraction-enums.h>
-#include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/update/common/animatable-property.h>
 #include <dali/internal/update/common/double-buffered.h>
 #include <dali/internal/update/common/inherited-property.h>
@@ -34,18 +31,6 @@ namespace Dali
 {
 namespace Internal
 {
-// value types used by messages
-template<>
-struct ParameterType<Dali::Camera::Type>
-: public BasicType<Dali::Camera::Type>
-{
-};
-template<>
-struct ParameterType<Dali::Camera::ProjectionMode>
-: public BasicType<Dali::Camera::ProjectionMode>
-{
-};
-
 namespace SceneGraph
 {
 class SceneController;
@@ -416,144 +401,8 @@ public:                                                             // PROPERTIE
   DoubleBuffered<Matrix>        mFinalProjection;       ///< Final projection matrix; double buffered for input handling
 };
 
-// Messages for Camera
-
-inline void SetTypeMessage(EventThreadServices& eventThreadServices, const Camera& camera, Dali::Camera::Type parameter)
-{
-  using LocalType = MessageValue1<Camera, Dali::Camera::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::SetType, parameter);
-}
-
-inline void SetProjectionModeMessage(EventThreadServices& eventThreadServices, const Camera& camera, Dali::Camera::ProjectionMode parameter)
-{
-  using LocalProjectionMode = MessageValue1<Camera, Dali::Camera::ProjectionMode>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalProjectionMode));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalProjectionMode(&camera, &Camera::SetProjectionMode, parameter);
-}
-
-inline void SetProjectionDirectionMessage(EventThreadServices& eventThreadServices, const Camera& camera, Dali::DevelCameraActor::ProjectionDirection parameter)
-{
-  using LocalProjectionDirection = MessageValue1<Camera, Dali::DevelCameraActor::ProjectionDirection>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalProjectionDirection));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalProjectionDirection(&camera, &Camera::SetProjectionDirection, parameter);
-}
-
-inline void BakeFieldOfViewMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
-{
-  using LocalType = MessageDoubleBuffered1<Camera, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::BakeFieldOfView, parameter);
-}
-
-inline void BakeOrthographicSizeMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
-{
-  using LocalType = MessageDoubleBuffered1<Camera, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::BakeOrthographicSize, parameter);
-}
-
-inline void BakeAspectRatioMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
-{
-  using LocalType = MessageDoubleBuffered1<Camera, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::BakeAspectRatio, parameter);
-}
-
-inline void SetNearClippingPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
-{
-  using LocalType = MessageValue1<Camera, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::SetNearClippingPlane, parameter);
-}
-
-inline void SetFarClippingPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, float parameter)
-{
-  using LocalType = MessageValue1<Camera, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::SetFarClippingPlane, parameter);
-}
-
-inline void SetReflectByPlaneMessage(EventThreadServices& eventThreadServices, const Camera& camera, const Vector4& plane)
-{
-  using LocalType = MessageValue1<Camera, Vector4>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::SetReflectByPlane, plane);
-}
-
-inline void SetTargetPositionMessage(EventThreadServices& eventThreadServices, const Camera& camera, const Vector3& parameter)
-{
-  using LocalType = MessageValue1<Camera, Vector3>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::SetTargetPosition, parameter);
-}
-
-inline void SetInvertYAxisMessage(EventThreadServices& eventThreadServices, const Camera& camera, bool parameter)
-{
-  using LocalType = MessageValue1<Camera, bool>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::SetInvertYAxis, parameter);
-}
-
-inline void RotateProjectionMessage(EventThreadServices& eventThreadServices, const Camera& camera, int parameter)
-{
-  typedef MessageValue1<Camera, int> LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&camera, &Camera::RotateProjection, parameter);
-}
-
 } // namespace SceneGraph
-
 } // namespace Internal
-
 } // namespace Dali
 
 #endif // DALI_INTERNAL_SCENE_GRAPH_CAMERA_H
diff --git a/dali/internal/update/render-tasks/scene-graph-render-task-messages.h b/dali/internal/update/render-tasks/scene-graph-render-task-messages.h
new file mode 100644 (file)
index 0000000..8762f02
--- /dev/null
@@ -0,0 +1,145 @@
+#ifndef DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_MESSAGES_H
+#define DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_MESSAGES_H
+
+/*
+ * Copyright (c) 2023 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/common/buffer-index.h>
+#include <dali/internal/common/message.h>
+#include <dali/internal/event/common/event-thread-services.h>
+#include <dali/internal/render/common/render-instruction.h>
+#include <dali/internal/render/renderers/render-frame-buffer.h>
+#include <dali/internal/update/common/animatable-property.h>
+#include <dali/internal/update/common/property-owner.h>
+#include <dali/internal/update/manager/update-manager.h>
+#include <dali/public-api/math/viewport.h>
+#include <dali/public-api/render-tasks/render-task.h>
+
+namespace Dali::Internal::SceneGraph
+{
+// Messages for RenderTask
+inline void SetFrameBufferMessage(EventThreadServices& eventThreadServices, const RenderTask& task, Render::FrameBuffer* frameBuffer)
+{
+  using LocalType = MessageValue1<RenderTask, Render::FrameBuffer*>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&task, &RenderTask::SetFrameBuffer, frameBuffer);
+}
+
+inline void SetClearEnabledMessage(EventThreadServices& eventThreadServices, const RenderTask& task, bool enabled)
+{
+  using LocalType = MessageValue1<RenderTask, bool>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&task, &RenderTask::SetClearEnabled, enabled);
+}
+
+inline void SetCullModeMessage(EventThreadServices& eventThreadServices, const RenderTask& task, bool mode)
+{
+  using LocalType = MessageValue1<RenderTask, bool>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&task, &RenderTask::SetCullMode, mode);
+}
+
+inline void SetRefreshRateMessage(EventThreadServices& eventThreadServices, const RenderTask& task, uint32_t refreshRate)
+{
+  using LocalType = MessageValue1<RenderTask, uint32_t>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&task, &RenderTask::SetRefreshRate, refreshRate);
+}
+
+inline void SetSourceNodeMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Node* constNode)
+{
+  // Scene graph thread can destroy this object.
+  Node* node = const_cast<Node*>(constNode);
+
+  using LocalType = MessageValue1<RenderTask, Node*>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&task, &RenderTask::SetSourceNode, node);
+}
+
+inline void SetCameraMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Node* constNode, const Camera* constCamera)
+{
+  using LocalType = MessageValue2<RenderTask, Node*, Camera*>;
+
+  Node*   node   = const_cast<Node*>(constNode);
+  Camera* camera = const_cast<Camera*>(constCamera);
+  // Reserve memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&task, &RenderTask::SetCamera, node, camera);
+}
+
+inline void SetViewportGuideNodeMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Node* constNode)
+{
+  // Scene graph thread can destroy this object.
+  Node* node = const_cast<Node*>(constNode);
+
+  using LocalType = MessageValue1<RenderTask, Node*>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&task, &RenderTask::SetViewportGuideNode, node);
+}
+
+inline void SetExclusiveMessage(EventThreadServices& eventThreadServices, const RenderTask& task, bool exclusive)
+{
+  using LocalType = MessageValue1<RenderTask, bool>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&task, &RenderTask::SetExclusive, exclusive);
+}
+
+inline void SetSyncRequiredMessage(EventThreadServices& eventThreadServices, const RenderTask& task, bool requiresSync)
+{
+  using LocalType = MessageValue1<RenderTask, bool>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&task, &RenderTask::SetSyncRequired, requiresSync);
+}
+
+} // namespace Dali::Internal::SceneGraph
+
+#endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_MESSAGES_H
index 90dca93..d49af14 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -167,21 +167,11 @@ bool RenderTask::QueryViewport(BufferIndex bufferIndex, Viewport& viewport) cons
   return true;
 }
 
-void RenderTask::SetClearColor(BufferIndex updateBufferIndex, const Vector4& value)
-{
-  mClearColor.Set(updateBufferIndex, value);
-}
-
 const Vector4& RenderTask::GetClearColor(BufferIndex bufferIndex) const
 {
   return mClearColor[bufferIndex];
 }
 
-void RenderTask::BakeClearColor(BufferIndex updateBufferIndex, const Vector4& value)
-{
-  mClearColor.Bake(updateBufferIndex, value);
-}
-
 void RenderTask::SetClearEnabled(bool enabled)
 {
   mClearEnabled = enabled;
@@ -425,14 +415,13 @@ void RenderTask::UpdateViewport(BufferIndex updateBufferIndex, Vector2 sceneSize
     Vector3 halfNodeSize(nodeSize * 0.5f);
     Vector2 screenPosition(halfSceneSize.width + worldPosition.x - halfNodeSize.x,
                            halfSceneSize.height + worldPosition.y - halfNodeSize.y);
-    SetViewportPosition(updateBufferIndex, screenPosition);
-    SetViewportSize(updateBufferIndex, Vector2(nodeSize));
-  }
-}
 
-void RenderTask::SetViewportPosition(BufferIndex updateBufferIndex, const Vector2& value)
-{
-  mViewportPosition.Set(updateBufferIndex, value);
+    /* This is an implicit constraint - the properties will be dirty until the node
+     * is removed. (RenderTask::Impl manages this)
+     */
+    mViewportPosition.Set(updateBufferIndex, screenPosition);
+    mViewportSize.Set(updateBufferIndex, Vector2(nodeSize));
+  }
 }
 
 const Vector2& RenderTask::GetViewportPosition(BufferIndex bufferIndex) const
@@ -440,26 +429,11 @@ const Vector2& RenderTask::GetViewportPosition(BufferIndex bufferIndex) const
   return mViewportPosition[bufferIndex];
 }
 
-void RenderTask::BakeViewportPosition(BufferIndex updateBufferIndex, const Vector2& value)
-{
-  mViewportPosition.Bake(updateBufferIndex, value);
-}
-
-void RenderTask::SetViewportSize(BufferIndex updateBufferIndex, const Vector2& value)
-{
-  mViewportSize.Set(updateBufferIndex, value);
-}
-
 const Vector2& RenderTask::GetViewportSize(BufferIndex bufferIndex) const
 {
   return mViewportSize[bufferIndex];
 }
 
-void RenderTask::BakeViewportSize(BufferIndex updateBufferIndex, const Vector2& value)
-{
-  mViewportSize.Bake(updateBufferIndex, value);
-}
-
 bool RenderTask::GetViewportEnabled(BufferIndex bufferIndex) const
 {
   if(fabsf(mViewportPosition[bufferIndex].x) > Math::MACHINE_EPSILON_1 ||
index 0d5142c..13947f8 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -19,9 +19,6 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/internal/common/buffer-index.h>
-#include <dali/internal/common/message.h>
-#include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/render/common/render-instruction.h>
 #include <dali/internal/render/renderers/render-frame-buffer.h>
 #include <dali/internal/update/common/animatable-property.h>
@@ -413,158 +410,6 @@ private:
   bool mCullMode : 1;        ///< Whether renderers should be frustum culled
 };
 
-// Messages for RenderTask
-inline void SetFrameBufferMessage(EventThreadServices& eventThreadServices, const RenderTask& task, Render::FrameBuffer* frameBuffer)
-{
-  using LocalType = MessageValue1<RenderTask, Render::FrameBuffer*>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetFrameBuffer, frameBuffer);
-}
-
-inline void SetClearColorMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Vector4& value)
-{
-  using LocalType = MessageDoubleBuffered1<RenderTask, Vector4>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetClearColor, value);
-}
-
-inline void BakeClearColorMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Vector4& value)
-{
-  using LocalType = MessageDoubleBuffered1<RenderTask, Vector4>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::BakeClearColor, value);
-}
-
-inline void SetClearEnabledMessage(EventThreadServices& eventThreadServices, const RenderTask& task, bool enabled)
-{
-  using LocalType = MessageValue1<RenderTask, bool>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetClearEnabled, enabled);
-}
-
-inline void SetCullModeMessage(EventThreadServices& eventThreadServices, const RenderTask& task, bool mode)
-{
-  using LocalType = MessageValue1<RenderTask, bool>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetCullMode, mode);
-}
-
-inline void SetRefreshRateMessage(EventThreadServices& eventThreadServices, const RenderTask& task, uint32_t refreshRate)
-{
-  using LocalType = MessageValue1<RenderTask, uint32_t>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetRefreshRate, refreshRate);
-}
-
-inline void SetSourceNodeMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Node* constNode)
-{
-  // Scene graph thread can destroy this object.
-  Node* node = const_cast<Node*>(constNode);
-
-  using LocalType = MessageValue1<RenderTask, Node*>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetSourceNode, node);
-}
-
-inline void SetCameraMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Node* constNode, const Camera* constCamera)
-{
-  using LocalType = MessageValue2<RenderTask, Node*, Camera*>;
-
-  Node*   node   = const_cast<Node*>(constNode);
-  Camera* camera = const_cast<Camera*>(constCamera);
-  // Reserve memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetCamera, node, camera);
-}
-
-inline void SetViewportGuideNodeMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Node* constNode)
-{
-  // Scene graph thread can destroy this object.
-  Node* node = const_cast<Node*>(constNode);
-
-  using LocalType = MessageValue1<RenderTask, Node*>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetViewportGuideNode, node);
-}
-
-inline void SetExclusiveMessage(EventThreadServices& eventThreadServices, const RenderTask& task, bool exclusive)
-{
-  using LocalType = MessageValue1<RenderTask, bool>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetExclusive, exclusive);
-}
-
-inline void SetSyncRequiredMessage(EventThreadServices& eventThreadServices, const RenderTask& task, bool requiresSync)
-{
-  using LocalType = MessageValue1<RenderTask, bool>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::SetSyncRequired, requiresSync);
-}
-
-inline void BakeViewportPositionMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Vector2& value)
-{
-  using LocalType = MessageDoubleBuffered1<RenderTask, Vector2>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::BakeViewportPosition, value);
-}
-
-inline void BakeViewportSizeMessage(EventThreadServices& eventThreadServices, const RenderTask& task, const Vector2& value)
-{
-  using LocalType = MessageDoubleBuffered1<RenderTask, Vector2>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&task, &RenderTask::BakeViewportSize, value);
-}
-
 } // namespace SceneGraph
 
 } // namespace Internal
diff --git a/dali/internal/update/rendering/scene-graph-renderer-messages.h b/dali/internal/update/rendering/scene-graph-renderer-messages.h
new file mode 100644 (file)
index 0000000..625e196
--- /dev/null
@@ -0,0 +1,304 @@
+#ifndef DALI_INTERNAL_SCENE_GRAPH_RENDERER_MESSAGES_H
+#define DALI_INTERNAL_SCENE_GRAPH_RENDERER_MESSAGES_H
+
+/*
+ * Copyright (c) 2023 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/internal/common/message.h>
+#include <dali/internal/common/type-abstraction-enums.h>
+#include <dali/internal/event/common/event-thread-services.h>
+#include <dali/internal/update/common/property-resetter.h>
+#include <dali/internal/update/manager/update-manager.h>
+#include <dali/internal/update/rendering/scene-graph-renderer.h>
+
+namespace Dali::Internal::SceneGraph
+{
+class TextureSet;
+
+/// Messages
+inline void SetTexturesMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet)
+{
+  using LocalType = MessageValue1<Renderer, TextureSet*>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&renderer, &Renderer::SetTextures, const_cast<TextureSet*>(&textureSet));
+}
+
+inline void SetGeometryMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry)
+{
+  using LocalType = MessageValue1<Renderer, Render::Geometry*>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry));
+}
+
+inline void SetShaderMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Shader& shader)
+{
+  using LocalType = MessageValue1<Renderer, Shader*>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&renderer, &Renderer::SetShader, const_cast<Shader*>(&shader));
+}
+
+inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex)
+{
+  using LocalType = MessageValue1<Renderer, int>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&renderer, &Renderer::SetDepthIndex, depthIndex);
+}
+
+inline void SetFaceCullingModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode)
+{
+  using LocalType = MessageValue1<Renderer, FaceCullingMode::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetFaceCullingMode, faceCullingMode);
+}
+
+inline void SetBlendModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode)
+{
+  using LocalType = MessageValue1<Renderer, BlendMode::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetBlendMode, blendingMode);
+}
+
+inline void SetBlendingOptionsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t options)
+{
+  using LocalType = MessageValue1<Renderer, uint32_t>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetBlendingOptions, options);
+}
+
+inline void SetBlendColorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor)
+{
+  using LocalType = MessageValue1<Renderer, Vector4>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetBlendColor, blendColor);
+}
+
+inline void SetIndexedDrawFirstElementMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t firstElement)
+{
+  using LocalType = MessageValue1<Renderer, uint32_t>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawFirstElement, firstElement);
+}
+
+inline void SetIndexedDrawElementsCountMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t elementsCount)
+{
+  using LocalType = MessageValue1<Renderer, uint32_t>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount);
+}
+
+inline void SetEnablePreMultipliedAlphaMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied)
+{
+  using LocalType = MessageValue1<Renderer, bool>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied);
+}
+
+inline void SetDepthWriteModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode)
+{
+  using LocalType = MessageValue1<Renderer, DepthWriteMode::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetDepthWriteMode, depthWriteMode);
+}
+
+inline void SetDepthTestModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode)
+{
+  using LocalType = MessageValue1<Renderer, DepthTestMode::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetDepthTestMode, depthTestMode);
+}
+
+inline void SetDepthFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction)
+{
+  using LocalType = MessageValue1<Renderer, DepthFunction::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetDepthFunction, depthFunction);
+}
+
+inline void SetRenderModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode)
+{
+  using LocalType = MessageValue1<Renderer, RenderMode::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetRenderMode, mode);
+}
+
+inline void SetStencilFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction)
+{
+  using LocalType = MessageValue1<Renderer, StencilFunction::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetStencilFunction, stencilFunction);
+}
+
+inline void SetStencilFunctionMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int mask)
+{
+  using LocalType = MessageValue1<Renderer, int>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionMask, mask);
+}
+
+inline void SetStencilFunctionReferenceMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference)
+{
+  using LocalType = MessageValue1<Renderer, int>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference);
+}
+
+inline void SetStencilMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask)
+{
+  using LocalType = MessageValue1<Renderer, int>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetStencilMask, stencilMask);
+}
+
+inline void SetStencilOperationOnFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
+{
+  using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnFail, stencilOperation);
+}
+
+inline void SetStencilOperationOnZFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
+{
+  using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation);
+}
+
+inline void SetStencilOperationOnZPassMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
+{
+  using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation);
+}
+
+inline void BakeOpacityMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity)
+{
+  using LocalType = MessageDoubleBuffered1<Renderer, float>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::BakeOpacity, opacity);
+
+  OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+    new SceneGraph::BakerResetter(const_cast<Renderer*>(&renderer),
+                                  const_cast<AnimatableProperty<float>*>(&renderer.mOpacity),
+                                  SceneGraph::BakerResetter::Lifetime::BAKE));
+  SceneGraph::AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+inline void SetRenderingBehaviorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DevelRenderer::Rendering::Type renderingBehavior)
+{
+  using LocalType = MessageValue1<Renderer, DevelRenderer::Rendering::Type>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetRenderingBehavior, renderingBehavior);
+}
+
+inline void SetDrawCommandsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size)
+{
+  using LocalType = MessageValue2<Renderer, Dali::DevelRenderer::DrawCommand*, uint32_t>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetDrawCommands, pDrawCommands, size);
+}
+
+inline void SetRenderCallbackMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::RenderCallback* callback)
+{
+  using LocalType = MessageValue1<Renderer, Dali::RenderCallback*>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::SetRenderCallback, callback);
+}
+
+} // namespace Dali::Internal::SceneGraph
+
+#endif //DALI_INTERNAL_SCENE_GRAPH_RENDERER_MESSAGES_H
index be4bf71..889a791 100644 (file)
@@ -20,7 +20,6 @@
 #include <dali/devel-api/rendering/renderer-devel.h>
 #include <dali/internal/common/blending-options.h>
 #include <dali/internal/common/memory-pool-key.h>
-#include <dali/internal/common/type-abstraction-enums.h>
 #include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/render/data-providers/render-data-provider.h>
 #include <dali/internal/render/renderers/render-renderer.h>
@@ -662,271 +661,6 @@ public:
   int32_t                   mDepthIndex; ///< Used only in PrepareRenderInstructions
 };
 
-/// Messages
-inline void SetTexturesMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet)
-{
-  using LocalType = MessageValue1<Renderer, TextureSet*>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&renderer, &Renderer::SetTextures, const_cast<TextureSet*>(&textureSet));
-}
-
-inline void SetGeometryMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry)
-{
-  using LocalType = MessageValue1<Renderer, Render::Geometry*>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry));
-}
-
-inline void SetShaderMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Shader& shader)
-{
-  using LocalType = MessageValue1<Renderer, Shader*>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&renderer, &Renderer::SetShader, const_cast<Shader*>(&shader));
-}
-
-inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex)
-{
-  using LocalType = MessageValue1<Renderer, int>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&renderer, &Renderer::SetDepthIndex, depthIndex);
-}
-
-inline void SetFaceCullingModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode)
-{
-  using LocalType = MessageValue1<Renderer, FaceCullingMode::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetFaceCullingMode, faceCullingMode);
-}
-
-inline void SetBlendModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode)
-{
-  using LocalType = MessageValue1<Renderer, BlendMode::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetBlendMode, blendingMode);
-}
-
-inline void SetBlendingOptionsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t options)
-{
-  using LocalType = MessageValue1<Renderer, uint32_t>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetBlendingOptions, options);
-}
-
-inline void SetBlendColorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor)
-{
-  using LocalType = MessageValue1<Renderer, Vector4>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetBlendColor, blendColor);
-}
-
-inline void SetIndexedDrawFirstElementMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t firstElement)
-{
-  using LocalType = MessageValue1<Renderer, uint32_t>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawFirstElement, firstElement);
-}
-
-inline void SetIndexedDrawElementsCountMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t elementsCount)
-{
-  using LocalType = MessageValue1<Renderer, uint32_t>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount);
-}
-
-inline void SetEnablePreMultipliedAlphaMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied)
-{
-  using LocalType = MessageValue1<Renderer, bool>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied);
-}
-
-inline void SetDepthWriteModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode)
-{
-  using LocalType = MessageValue1<Renderer, DepthWriteMode::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetDepthWriteMode, depthWriteMode);
-}
-
-inline void SetDepthTestModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode)
-{
-  using LocalType = MessageValue1<Renderer, DepthTestMode::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetDepthTestMode, depthTestMode);
-}
-
-inline void SetDepthFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction)
-{
-  using LocalType = MessageValue1<Renderer, DepthFunction::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetDepthFunction, depthFunction);
-}
-
-inline void SetRenderModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode)
-{
-  using LocalType = MessageValue1<Renderer, RenderMode::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetRenderMode, mode);
-}
-
-inline void SetStencilFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction)
-{
-  using LocalType = MessageValue1<Renderer, StencilFunction::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetStencilFunction, stencilFunction);
-}
-
-inline void SetStencilFunctionMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int mask)
-{
-  using LocalType = MessageValue1<Renderer, int>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionMask, mask);
-}
-
-inline void SetStencilFunctionReferenceMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference)
-{
-  using LocalType = MessageValue1<Renderer, int>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference);
-}
-
-inline void SetStencilMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask)
-{
-  using LocalType = MessageValue1<Renderer, int>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetStencilMask, stencilMask);
-}
-
-inline void SetStencilOperationOnFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
-{
-  using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnFail, stencilOperation);
-}
-
-inline void SetStencilOperationOnZFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
-{
-  using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation);
-}
-
-inline void SetStencilOperationOnZPassMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
-{
-  using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation);
-}
-
-inline void BakeOpacityMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity)
-{
-  using LocalType = MessageDoubleBuffered1<Renderer, float>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::BakeOpacity, opacity);
-}
-
-inline void SetRenderingBehaviorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DevelRenderer::Rendering::Type renderingBehavior)
-{
-  using LocalType = MessageValue1<Renderer, DevelRenderer::Rendering::Type>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetRenderingBehavior, renderingBehavior);
-}
-
-inline void SetDrawCommandsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size)
-{
-  using LocalType = MessageValue2<Renderer, Dali::DevelRenderer::DrawCommand*, uint32_t>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetDrawCommands, pDrawCommands, size);
-}
-
-inline void SetRenderCallbackMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::RenderCallback* callback)
-{
-  using LocalType = MessageValue1<Renderer, Dali::RenderCallback*>;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
-
-  new(slot) LocalType(&renderer, &Renderer::SetRenderCallback, callback);
-}
-
 } // namespace SceneGraph
 } // namespace Internal
 } // namespace Dali