1 #ifndef DALI_INTERNAL_RENDER_TASK_LIST_H
2 #define DALI_INTERNAL_RENDER_TASK_LIST_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/object/base-object.h>
24 #include <dali/public-api/render-tasks/render-task-list.h>
26 #include <dali/internal/event/common/complete-notification-interface.h>
27 #include <dali/internal/event/events/actor-observer.h>
28 #include <dali/internal/event/render-tasks/render-task-impl.h>
34 class EventThreadServices;
35 class RenderTaskDefaults;
39 using RenderTaskPtr = IntrusivePtr<RenderTask>;
41 using RenderTaskListPtr = IntrusivePtr<RenderTaskList>;
47 } // namespace SceneGraph
50 * A proxy for the scene-graph RenderTaskList.
51 * A separate LayerList is maintained for actors added via the SystemLevel::Add().
53 class RenderTaskList : public BaseObject, public CompleteNotificationInterface
56 using RenderTaskContainer = std::vector<RenderTaskPtr>;
60 RenderTask* renderTaskPtr; ///< Pointer for comparison with current rendertask.
61 ActorObserver actor; ///< For comparison with current actor.
64 using ExclusivesContainer = std::vector<Exclusive>;
67 * Create a RenderTaskList.
68 * @return A newly allocated RenderTaskList; the caller takes ownership.
70 static RenderTaskListPtr New();
73 * @copydoc Dali::RenderTaskList::CreateTask()
75 RenderTaskPtr CreateTask();
78 * @brief Creates a new RenderTask.
80 * This will be appended to the list of render-tasks.
82 * @param[in] sourceActor The actor and its children to be rendered for this render task.
83 * @param[in] cameraActor The actor from which the scene is viewed for this render task.
84 * @return A valid handle to a new RenderTask
86 RenderTaskPtr CreateTask(Actor* sourceActor, CameraActor* cameraActor);
89 * @copydoc Dali::RenderTaskList::RemoveTask()
91 void RemoveTask(Internal::RenderTask& task);
94 * @copydoc Dali::RenderTaskList::GetTaskCount()
96 uint32_t GetTaskCount() const;
99 * @copydoc Dali::RenderTaskList::GetTask()
101 RenderTaskPtr GetTask(uint32_t index) const;
104 * Retrieve the container of render-tasks.
105 * @return The container.
107 RenderTaskContainer& GetTasks()
113 * @brief Mark a rendertask as having exclusive access to its source actor.
115 * @param[in] task Pointer to the rendertask.
116 * @param[in] exclusive If a rendertask is to have exclusive acesss to its source actor.
118 void SetExclusive(RenderTask* task, bool exclusive);
121 * @brief Return the list of rendertasks that exclusively own their source actor.
123 * @return [description]
125 const ExclusivesContainer& GetExclusivesList() const
131 * Provide notification signals for a "Finished" render task.
132 * This method should be called in the event-thread
133 * Queue NotifyFinishedMessage() from update-thread
134 * @param object pointer to this class instance
136 static void NotifyFinished(void* object);
139 * This method refreshes all render tasks that have a frame buffer
140 * and a refresh rate of RefreshOnce.
142 void RecoverFromContextLoss();
145 * Retrieve the SceneGraph::RenderTaskList object.
146 * @return The RenderTaskList.
148 const SceneGraph::RenderTaskList& GetSceneObject() const;
152 * Construct a new RenderTaskList.
157 * A reference counted object may only be deleted by calling Unreference()
159 ~RenderTaskList() override;
162 * 2nd-phase construction
166 private: // from CompleteNotificationInterface
168 * @copydoc CompleteNotificationInterface::NotifyCompleted()
170 void NotifyCompleted() override;
173 EventThreadServices& mEventThreadServices;
174 RenderTaskDefaults& mDefaults;
176 SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
178 RenderTaskContainer mTasks; ///< Reference counted render-tasks
179 ExclusivesContainer mExclusives; ///< List of rendertasks with exclusively owned source actors.
182 } // namespace Internal
184 // Helpers for public-api forwarding methods
186 inline Internal::RenderTaskList& GetImplementation(Dali::RenderTaskList& taskList)
188 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
190 BaseObject& handle = taskList.GetBaseObject();
192 return static_cast<Internal::RenderTaskList&>(handle);
195 inline const Internal::RenderTaskList& GetImplementation(const Dali::RenderTaskList& taskList)
197 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
199 const BaseObject& handle = taskList.GetBaseObject();
201 return static_cast<const Internal::RenderTaskList&>(handle);
206 #endif // DALI_INTERNAL_RENDER_TASK_LIST_H