#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;
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;
+}
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:
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);
/*
- * 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.
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(
#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
{
/*
- * 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.
#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;
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;
}
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;
}
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;
}
// 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;
}
// 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;
// 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;
}
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;
}
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;
}
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;
}
/*
- * 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.
#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>
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);
}
}
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
{
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
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);
}
}
/*
- * 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.
#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>
* @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);
}
}
{
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;
}
}
/*
- * 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.
#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>
{
if(!Equals(mOpacity, opacity))
{
- mOpacity = opacity;
- BakeOpacityMessage(GetEventThreadServices(), GetRendererSceneObject(), mOpacity);
+ mOpacity = opacity;
+ auto sceneObject = const_cast<SceneGraph::Renderer*>(&GetRendererSceneObject());
+ SceneGraph::BakeOpacityMessage(GetEventThreadServices(), *sceneObject, mOpacity);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+ new SceneGraph::BakerResetter(sceneObject,
+ &sceneObject->mOpacity,
+ SceneGraph::BakerResetter::Lifetime::BAKE));
+ AddResetterMessage(GetEventThreadServices().GetUpdateManager(), resetter);
}
}
break;
/*
- * 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.
#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>
if(visualProperties)
{
- BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mTransformOffset, mPropertyCache.mTransformOffset);
+ BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformOffset, mPropertyCache.mTransformOffset);
}
}
break;
auto visualProperties = sceneObject.GetVisualProperties();
if(visualProperties)
{
- BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mTransformSize, mPropertyCache.mTransformSize);
+ BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformSize, mPropertyCache.mTransformSize);
}
}
break;
auto visualProperties = sceneObject.GetVisualProperties();
if(visualProperties)
{
- BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mTransformOrigin, mPropertyCache.mTransformOrigin);
+ BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformOrigin, mPropertyCache.mTransformOrigin);
}
}
break;
auto visualProperties = sceneObject.GetVisualProperties();
if(visualProperties)
{
- BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mTransformAnchorPoint, mPropertyCache.mTransformAnchorPoint);
+ BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformAnchorPoint, mPropertyCache.mTransformAnchorPoint);
}
}
break;
auto visualProperties = sceneObject.GetVisualProperties();
if(visualProperties)
{
- BakeMessage<Vector4>(GetEventThreadServices(), visualProperties->mTransformOffsetSizeMode, mPropertyCache.mTransformOffsetSizeMode);
+ BakeMessage<Vector4>(GetEventThreadServices(), *mUpdateObject, visualProperties->mTransformOffsetSizeMode, mPropertyCache.mTransformOffsetSizeMode);
}
}
break;
auto visualProperties = sceneObject.GetVisualProperties();
if(visualProperties)
{
- BakeMessage<Vector2>(GetEventThreadServices(), visualProperties->mExtraSize, mPropertyCache.mExtraSize);
+ BakeMessage<Vector2>(GetEventThreadServices(), *mUpdateObject, visualProperties->mExtraSize, mPropertyCache.mExtraSize);
}
}
break;
auto visualProperties = sceneObject.GetVisualProperties();
if(visualProperties)
{
- BakeMessage<Vector3>(GetEventThreadServices(), visualProperties->mMixColor, mPropertyCache.mMixColor);
+ BakeMessage<Vector3>(GetEventThreadServices(), *mUpdateObject, visualProperties->mMixColor, mPropertyCache.mMixColor);
}
}
break;
if(visualProperties)
{
mPropertyCache.mPreMultipliedAlpha = preMultipliedAlpha;
- BakeMessage<float>(GetEventThreadServices(), visualProperties->mPreMultipliedAlpha, preMultipliedAlpha);
+ BakeMessage<float>(GetEventThreadServices(), *mUpdateObject, visualProperties->mPreMultipliedAlpha, preMultipliedAlpha);
}
}
}
#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>
--- /dev/null
+#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
+{
+// Messages for AnimatableProperty<T>
+
+template<class T>
+void BakeMessage(EventThreadServices& eventThreadServices,
+ const SceneGraph::PropertyOwner& propertyOwner,
+ 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);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+ new SceneGraph::BakerResetter(const_cast<SceneGraph::PropertyOwner*>(&propertyOwner),
+ const_cast<SceneGraph::AnimatableProperty<T>*>(&property),
+ SceneGraph::BakerResetter::Lifetime::BAKE));
+ AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+template<class T>
+void BakeRelativeMessage(EventThreadServices& eventThreadServices,
+ const SceneGraph::PropertyOwner& propertyOwner,
+ 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);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+ new SceneGraph::BakerResetter(const_cast<SceneGraph::PropertyOwner*>(&propertyOwner),
+ const_cast<SceneGraph::AnimatableProperty<T>*>(&property),
+ SceneGraph::BakerResetter::Lifetime::BAKE));
+ AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+template<class T>
+void SetXComponentMessage(EventThreadServices& eventThreadServices,
+ const SceneGraph::PropertyOwner& propertyOwner,
+ 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);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+ new SceneGraph::BakerResetter(const_cast<SceneGraph::PropertyOwner*>(&propertyOwner),
+ const_cast<SceneGraph::AnimatableProperty<T>*>(&property),
+ SceneGraph::BakerResetter::Lifetime::BAKE));
+ AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+template<class T>
+void SetYComponentMessage(EventThreadServices& eventThreadServices,
+ const SceneGraph::PropertyOwner& propertyOwner,
+ 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);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+ new SceneGraph::BakerResetter(const_cast<SceneGraph::PropertyOwner*>(&propertyOwner),
+ const_cast<SceneGraph::AnimatableProperty<T>*>(&property),
+ SceneGraph::BakerResetter::Lifetime::BAKE));
+ AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+template<class T>
+void SetZComponentMessage(EventThreadServices& eventThreadServices,
+ const SceneGraph::PropertyOwner& propertyOwner,
+ 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);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+ new SceneGraph::BakerResetter(const_cast<SceneGraph::PropertyOwner*>(&propertyOwner),
+ const_cast<SceneGraph::AnimatableProperty<T>*>(&property),
+ SceneGraph::BakerResetter::Lifetime::BAKE));
+ AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+template<class T>
+void SetWComponentMessage(EventThreadServices& eventThreadServices,
+ const SceneGraph::PropertyOwner& propertyOwner,
+ 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);
+
+ OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+ new SceneGraph::BakerResetter(const_cast<SceneGraph::PropertyOwner*>(&propertyOwner),
+ const_cast<SceneGraph::AnimatableProperty<T>*>(&property),
+ SceneGraph::BakerResetter::Lifetime::BAKE));
+ AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+} // namespace Dali::Internal
+
+#endif //DALI_INTERNAL_COMMON_ANIMATABLE_PROPERTY_MESSAGES_H
#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>
} // 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
#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.
*/
// INTERNAL INCLUDES
+#include <dali/internal/common/buffer-index.h>
#include <dali/internal/common/owner-pointer.h>
namespace Dali
#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.
* 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)
{
*/
virtual bool IsFinished()
{
- bool finished = mRunning <= STOPPED;
- if(mRunning == AGING)
- {
- mRunning = STOPPED;
- }
- return finished;
+ return mRunning <= STOPPED;
}
-protected:
enum
{
STOPPED = 0,
ACTIVE = 2,
};
+protected:
/**
* Constructor
*
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)
*/
-#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.
}
private:
- TransformManagerVector3Input(const TransformManagerVector3Input& property) = delete;
+ TransformManagerVector3Input(const TransformManagerVector3Input& property) = delete;
TransformManagerVector3Input& operator=(const TransformManagerVector3Input& rhs) = delete;
public:
}
private:
- TransformManagerQuaternionInput(const TransformManagerQuaternionInput& property) = delete;
+ TransformManagerQuaternionInput(const TransformManagerQuaternionInput& property) = delete;
TransformManagerQuaternionInput& operator=(const TransformManagerQuaternionInput& rhs) = delete;
public:
}
private:
- TransformManagerMatrixInput(const TransformManagerMatrixInput& property) = delete;
+ TransformManagerMatrixInput(const TransformManagerMatrixInput& property) = delete;
TransformManagerMatrixInput& operator=(const TransformManagerMatrixInput& rhs) = delete;
};
} // namespace Internal
} // namespace Dali
-#endif // TRANSFORM_MANAGER_PROPERTY_H_
+#endif // DALI_INTERNAL_UPDATE_TRANSFORM_MANAGER_PROPERTY_H
#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.
// 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);
}
/**
// 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);
}
/**
#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
--- /dev/null
+#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
// 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>
{
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;
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
--- /dev/null
+#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
/*
- * 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.
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;
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
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 ||
#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.
*/
// 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>
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
--- /dev/null
+#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
#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>
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