Merge "Print line numbers with shader source."
[platform/core/uifw/dali-core.git] / dali / internal / event / render-tasks / render-task-list-impl.h
1 #ifndef __DALI_INTERNAL_RENDER_TASK_LIST_H__
2 #define __DALI_INTERNAL_RENDER_TASK_LIST_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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
10 //
11 //     http://floralicense.org/license/
12 //
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.
18 //
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/common/vector-wrapper.h>
22 #include <dali/public-api/object/base-object.h>
23 #include <dali/public-api/render-tasks/render-task.h>
24 #include <dali/public-api/render-tasks/render-task-list.h>
25 #include <dali/internal/common/message.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 class EventToUpdate;
34 class RenderTaskDefaults;
35
36 namespace SceneGraph
37 {
38 class RenderTaskList;
39 class UpdateManager;
40 }
41
42 /**
43  * A proxy for the scene-graph RenderTaskList.
44  * A separate LayerList is maintained for actors added via the SystemLevel::Add().
45  */
46 class RenderTaskList : public BaseObject
47 {
48 public:
49
50   typedef std::vector< Dali::RenderTask > RenderTaskContainer;
51
52   /**
53    * Create a RenderTaskList.
54    * @param[in] updateManager Used for creating render-tasks in the scene graph.
55    * @param[in] defaults Provides the default source & camera actors.
56    * @param[in] systemLevel True if this is the LayerList for actors added via the SystemLevel::Add().
57    * @return A newly allocated RenderTaskList; the caller takes ownership.
58    */
59   static RenderTaskList* New( SceneGraph::UpdateManager& updateManager, RenderTaskDefaults& defaults, bool systemLevel );
60
61   /**
62    * @copydoc Dali::RenderTaskList::CreateTask()
63    */
64   Dali::RenderTask CreateTask();
65
66   /**
67    * @copydoc Dali::RenderTaskList::RemoveTask()
68    */
69   void RemoveTask( Dali::RenderTask task );
70
71   /**
72    * @copydoc Dali::RenderTaskList::GetTaskCount()
73    */
74   unsigned int GetTaskCount() const;
75
76   /**
77    * @copydoc Dali::RenderTaskList::GetTask()
78    */
79   Dali::RenderTask GetTask( unsigned int index ) const;
80
81   /**
82    * Retrieve the container of render-tasks.
83    * @return The container.
84    */
85   RenderTaskContainer& GetTasks()
86   {
87     return mTasks;
88   }
89
90   /**
91    * Provide notification signals for a "Finished" render task.
92    * This method should be called in the event-thread
93    * Queue NotifyFinishedMessage() from update-thread
94    */
95   void NotifyFinished();
96
97 protected:
98
99   /**
100    * Construct a new RenderTaskList.
101    * @param[in] eventToUpdate Used for creating render-tasks in the scene graph.
102    * @param[in] defaults Provides the default source & camera actors.
103    * @param[in] systemLevel True if this is the system-level list.
104    */
105   RenderTaskList( EventToUpdate& eventToUpdate, RenderTaskDefaults& defaults, bool systemLevel );
106
107   /**
108    * A reference counted object may only be deleted by calling Unreference()
109    */
110   virtual ~RenderTaskList();
111
112   /**
113    * 2nd-phase construction
114    */
115   void Initialize( SceneGraph::UpdateManager& updateManager );
116
117 private:
118
119   EventToUpdate& mEventToUpdate;
120   RenderTaskDefaults& mDefaults;
121
122   bool mIsSystemLevel; ///< True if the layers are added via the SystemLevel API
123
124   SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
125
126   RenderTaskContainer mTasks; ///< Reference counted render-tasks
127 };
128
129 /**
130  * Notification message for when 1+ render tasks have finished
131  * @param[in] renderTaskList This will provide the notification signals.
132  */
133 inline MessageBase* NotifyFinishedMessage( RenderTaskList& renderTaskList )
134 {
135   return new Message< RenderTaskList >( &renderTaskList, &RenderTaskList::NotifyFinished );
136 }
137
138 } // namespace Internal
139
140 // Helpers for public-api forwarding methods
141
142 inline Internal::RenderTaskList& GetImplementation(Dali::RenderTaskList& taskList)
143 {
144   DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
145
146   BaseObject& handle = taskList.GetBaseObject();
147
148   return static_cast<Internal::RenderTaskList&>(handle);
149 }
150
151 inline const Internal::RenderTaskList& GetImplementation(const Dali::RenderTaskList& taskList)
152 {
153   DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
154
155   const BaseObject& handle = taskList.GetBaseObject();
156
157   return static_cast<const Internal::RenderTaskList&>(handle);
158 }
159
160 } // namespace Dali
161
162 #endif //__DALI_INTERNAL_RENDER_TASK_LIST_H__