1 #ifndef __DALI_INTERNAL_RENDER_TASK_LIST_H__
2 #define __DALI_INTERNAL_RENDER_TASK_LIST_H__
5 * Copyright (c) 2018 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>
25 #include <dali/internal/event/common/complete-notification-interface.h>
26 #include <dali/internal/event/render-tasks/render-task-impl.h>
34 class EventThreadServices;
35 class RenderTaskDefaults;
40 using RenderTaskListPtr = IntrusivePtr<RenderTaskList>;
49 * A proxy for the scene-graph RenderTaskList.
50 * A separate LayerList is maintained for actors added via the SystemLevel::Add().
52 class RenderTaskList : public BaseObject, public CompleteNotificationInterface
56 using RenderTaskContainer = std::vector< RenderTaskPtr >;
60 RenderTask* renderTaskPtr; ///< Pointer for comparison with current rendertask.
61 Actor* actorPtr; ///< Pointer for comparison with current actor.
65 * Create a RenderTaskList.
66 * @return A newly allocated RenderTaskList; the caller takes ownership.
68 static RenderTaskListPtr New();
71 * @copydoc Dali::RenderTaskList::CreateTask()
73 RenderTaskPtr CreateTask();
76 * @brief Creates a new RenderTask.
78 * This will be appended to the list of render-tasks.
80 * @param[in] sourceActor The actor and its children to be rendered for this render task.
81 * @param[in] cameraActor The actor from which the scene is viewed for this render task.
82 * @return A valid handle to a new RenderTask
84 RenderTaskPtr CreateTask( Actor* sourceActor, CameraActor* cameraActor);
87 * @copydoc Dali::RenderTaskList::RemoveTask()
89 void RemoveTask( Internal::RenderTask& task );
92 * @copydoc Dali::RenderTaskList::GetTaskCount()
94 uint32_t GetTaskCount() const;
97 * @copydoc Dali::RenderTaskList::GetTask()
99 RenderTaskPtr GetTask( uint32_t index ) const;
102 * Retrieve the container of render-tasks.
103 * @return The container.
105 RenderTaskContainer& GetTasks()
111 * @brief Mark a rendertask as having exclusive access to its source actor.
113 * @param[in] task Pointer to the rendertask.
114 * @param[in] exclusive If a rendertask is to have exclusive acesss to its source actor.
116 void SetExclusive( RenderTask* task, bool exclusive );
119 * @brief Return the list of rendertasks that exclusively own their source actor.
121 * @return [description]
123 const Vector< Exclusive >& GetExclusivesList() const
129 * Provide notification signals for a "Finished" render task.
130 * This method should be called in the event-thread
131 * Queue NotifyFinishedMessage() from update-thread
132 * @param object pointer to this class instance
134 static void NotifyFinished( void* object );
137 * This method refreshes all render tasks that have a frame buffer
138 * and a refresh rate of RefreshOnce.
140 void RecoverFromContextLoss();
145 * Construct a new RenderTaskList.
150 * A reference counted object may only be deleted by calling Unreference()
152 virtual ~RenderTaskList();
155 * 2nd-phase construction
159 private: // from CompleteNotificationInterface
162 * @copydoc CompleteNotificationInterface::NotifyCompleted()
164 virtual void NotifyCompleted();
168 EventThreadServices& mEventThreadServices;
169 RenderTaskDefaults& mDefaults;
171 SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
173 RenderTaskContainer mTasks; ///< Reference counted render-tasks
174 Vector< Exclusive > mExclusives; ///< List of rendertasks with exclusively owned source actors.
177 } // namespace Internal
179 // Helpers for public-api forwarding methods
181 inline Internal::RenderTaskList& GetImplementation(Dali::RenderTaskList& taskList)
183 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
185 BaseObject& handle = taskList.GetBaseObject();
187 return static_cast<Internal::RenderTaskList&>(handle);
190 inline const Internal::RenderTaskList& GetImplementation(const Dali::RenderTaskList& taskList)
192 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
194 const BaseObject& handle = taskList.GetBaseObject();
196 return static_cast<const Internal::RenderTaskList&>(handle);
201 #endif //__DALI_INTERNAL_RENDER_TASK_LIST_H__