[3.0] Version downgrade (1.2.0 to 1.1.45)
[platform/core/uifw/dali-core.git] / dali / internal / update / manager / update-manager.h
1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__
3
4 /*
5  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
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
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/common/dali-common.h>
24
25 #include <dali/integration-api/resource-declarations.h>
26
27 #include <dali/internal/common/message.h>
28 #include <dali/internal/common/type-abstraction-enums.h>
29 #include <dali/internal/common/shader-saver.h>
30 #include <dali/internal/event/common/event-thread-services.h>
31 #include <dali/internal/update/animation/scene-graph-animation.h>
32 #include <dali/internal/update/common/scene-graph-buffers.h>
33 #include <dali/internal/update/common/scene-graph-property-notification.h>
34 #include <dali/internal/update/manager/object-owner-container.h>
35 #include <dali/internal/update/nodes/node.h>
36 #include <dali/internal/update/nodes/scene-graph-layer.h>
37 #include <dali/internal/update/rendering/scene-graph-renderer.h>
38 #include <dali/internal/render/shaders/scene-graph-shader.h>
39 #include <dali/internal/render/renderers/render-property-buffer.h>
40 #include <dali/internal/event/rendering/texture-impl.h>
41
42 namespace Dali
43 {
44
45 namespace Integration
46 {
47 class GlSyncAbstraction;
48 class RenderController;
49
50 } // namespace Integration
51
52 namespace Internal
53 {
54
55 class PropertyNotifier;
56 class NotificationManager;
57 class CompleteNotificationInterface;
58 class ResourceManager;
59 class TouchResampler;
60
61 namespace Render
62 {
63 struct Sampler;
64 class FrameBuffer;
65 }
66 // value types used by messages
67 template <> struct ParameterType< PropertyNotification::NotifyMode >
68 : public BasicType< PropertyNotification::NotifyMode > {};
69
70 namespace SceneGraph
71 {
72
73 class Animation;
74 class DiscardQueue;
75 class PanGesture;
76 class RenderManager;
77 class RenderTaskList;
78 class RenderQueue;
79 class TextureCacheDispatcher;
80 class PropertyBuffer;
81 class TextureSet;
82 class Camera;
83
84 /**
85  * UpdateManager maintains a scene graph i.e. a tree of nodes as well as
86  * other scene graph property owning objects.
87  * It controls the Update traversal, in which nodes are repositioned/animated,
88  * and organizes the the culling and rendering of the scene.
89  * It also maintains the lifecycle of nodes and other property owners that are
90  * disconnected from the scene graph.
91  */
92 class UpdateManager : public ShaderSaver
93 {
94 public:
95
96   /**
97    * Construct a new UpdateManager.
98    * @param[in] notificationManager This should be notified when animations have finished.
99    * @param[in] animationFinishedNotifier The CompleteNotificationInterface that handles animation completions
100    * @param[in] propertyNotifier The PropertyNotifier
101    * @param[in] resourceManager The resource manager used to load textures etc.
102    * @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
103    * @param[in] controller After messages are flushed, we request a render from the RenderController.
104    * @param[in] renderManager This is responsible for rendering the results of each "update".
105    * @param[in] renderQueue Used to queue messages for the next render.
106    * @param[in] textureCacheDispatcher Used for sending messages to texture cache.
107    */
108   UpdateManager( NotificationManager& notificationManager,
109                  CompleteNotificationInterface& animationFinishedNotifier,
110                  PropertyNotifier& propertyNotifier,
111                  ResourceManager& resourceManager,
112                  DiscardQueue& discardQueue,
113                  Integration::RenderController& controller,
114                  RenderManager& renderManager,
115                  RenderQueue& renderQueue,
116                  TextureCacheDispatcher& textureCacheDispatcher );
117
118   /**
119    * Destructor.
120    */
121   virtual ~UpdateManager();
122
123   // Node connection methods
124
125   /**
126    * Get the scene graph side list of RenderTasks.
127    * @param[in] systemLevel True if using the system-level overlay.
128    * @return The list of render tasks
129    */
130   RenderTaskList* GetRenderTaskList( bool systemLevel );
131
132   /**
133    * Installs a new layer as the root node.
134    * @pre The UpdateManager does not already have an installed root node.
135    * @pre The layer is of derived Node type Layer.
136    * @pre The layer does not have a parent.
137    * @param[in] layer The new root node.
138    * @param[in] systemLevel True if using the system-level overlay.
139    * @post The node is owned by UpdateManager.
140    */
141   void InstallRoot( Layer* layer, bool systemLevel );
142
143   /**
144    * Add a Node; UpdateManager takes ownership.
145    * @pre The node does not have a parent.
146    * @param[in] node The node to add.
147    */
148   void AddNode( Node* node );
149
150   /**
151    * Connect a Node to the scene-graph.
152    * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
153    * @pre The node does not already have a parent.
154    * @param[in] parent The new parent node.
155    */
156   void ConnectNode( Node* parent, Node* node );
157
158   /**
159    * Disconnect a Node from the scene-graph.
160    * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
161    * @pre The node has a parent.
162    * @param[in] node The node to disconnect.
163    */
164   void DisconnectNode( Node* node );
165
166   /**
167    * Destroy a Node owned by UpdateManager.
168    * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
169    * In the following update, the previously queued Nodes may be deleted.
170    * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
171    * @param[in] node The node to destroy.
172    */
173   void DestroyNode( Node* node );
174
175   /**
176    * Add a camera on scene
177    * @param[in] camera to add
178    */
179   void AddCamera( Camera* camera );
180
181   /**
182    * Remove a camera from scene
183    * @param[in] camera to remove
184    */
185   void RemoveCamera( const Camera* camera );
186
187   /**
188    * Add a newly created object.
189    * @param[in] object The object to add.
190    * @post The object is owned by UpdateManager.
191    */
192   void AddObject( PropertyOwner* object );
193
194   /**
195    * Remove an object.
196    * @param[in] object The object to remove.
197    */
198   void RemoveObject( PropertyOwner* object );
199
200   // Animations
201
202   /**
203    * Add a newly created animation.
204    * @param[in] animation The animation to add.
205    * @post The animation is owned by UpdateManager.
206    */
207   void AddAnimation( Animation* animation );
208
209   /**
210    * Stop an animation.
211    * @param[in] animation The animation to stop.
212    */
213   void StopAnimation( Animation* animation );
214
215   /**
216    * Remove an animation.
217    * @param[in] animation The animation to remove.
218    */
219   void RemoveAnimation( Animation* animation );
220
221   /**
222    * Query whether any animations are currently running.
223    * @return True if any animations are running.
224    */
225   bool IsAnimationRunning() const;
226
227   // Property Notification
228
229   /**
230    * Add a newly created property notification
231    * @param[in] propertyNotification The notification to add
232    * @post The propertyNotification is owned by UpdateManager.
233    */
234   void AddPropertyNotification( PropertyNotification* propertyNotification );
235
236   /**
237    * Remove a property notification
238    * @param[in] propertyNotification The notification to remove
239    */
240   void RemovePropertyNotification( PropertyNotification* propertyNotification );
241
242   /**
243    * Set Notify state for PropertyNotification
244    * @param[in] propertyNotification The notification to remove
245    * @param[in] notifyMode The notification mode.
246    */
247   void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
248
249   /**
250    * @brief Get the renderer owner
251    *
252    * @return The renderer owner
253    */
254   ObjectOwnerContainer< Renderer >& GetRendererOwner();
255
256   /**
257    * @brief Get the property buffer owner
258    *
259    * @return The property buffer owner
260    */
261   ObjectOwnerContainer< PropertyBuffer >& GetPropertyBufferOwner();
262
263
264   // Shaders
265
266   /**
267    * Add a newly created shader.
268    * @param[in] shader The shader to add.
269    * @post The shader is owned by the UpdateManager.
270    */
271   void AddShader(Shader* shader);
272
273   /**
274    * Remove a shader.
275    * @pre The shader has been added to the UpdateManager.
276    * @param[in] shader The shader to remove.
277    * @post The shader is destroyed.
278    */
279   void RemoveShader(Shader* shader);
280
281   /**
282    * Add a newly created TextureSet.
283    * @param[in] textureSet The texture set to add.
284    * @post The TextureSet is owned by the UpdateManager.
285    */
286   void AddTextureSet(TextureSet* textureSet);
287
288   /**
289    * Remove a TextureSet.
290    * @pre The TextureSet has been added to the UpdateManager.
291    * @param[in] textureSet The TextureSet to remove.
292    * @post The TextureSet is destroyed.
293    */
294   void RemoveTextureSet(TextureSet* textureSet);
295
296   /**
297    * Set the shader program for a Shader object
298    * @param[in] shader        The shader to modify
299    * @param[in] shaderData    Source code, hash over source, and optional compiled binary for the shader program
300    * @param[in] modifiesGeometry True if the vertex shader modifies geometry
301    */
302   void SetShaderProgram( Shader* shader, Internal::ShaderDataPtr shaderData, bool modifiesGeometry );
303
304   /**
305    * @brief Accept compiled shaders passed back on render thread for saving.
306    * @param[in] shaderData Source code, hash over source, and corresponding compiled binary to be saved.
307    */
308   virtual void SaveBinary( Internal::ShaderDataPtr shaderData );
309
310   /**
311    * @brief Set the destination for compiled shader binaries to be passed on to.
312    * The dispatcher passed in will be called from the update thread.
313    * @param[in] upstream A sink for ShaderDatas to be passed into.
314    */
315   void SetShaderSaver( ShaderSaver& upstream );
316
317   // Gestures
318
319   /**
320    * Add a newly created gesture.
321    * @param[in] gesture The gesture to add.
322    * @post The gesture is owned by the UpdateManager.
323    */
324   void AddGesture( PanGesture* gesture );
325
326   /**
327    * Remove a gesture.
328    * @pre The gesture has been added to the UpdateManager.
329    * @param[in] gesture The gesture to remove.
330    * @post The gesture is destroyed.
331    */
332   void RemoveGesture( PanGesture* gesture );
333
334 // Message queue handling
335
336   /**
337    * Reserve space for another message in the queue; this must then be initialized by the caller.
338    * The message will be read from the update-thread after the next FlushMessages is called.
339    * @post Calling this method may invalidate any previously returned slots.
340    * @param[in] size The message size with respect to the size of type "char".
341    * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
342    * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
343    * @return A pointer to the first char allocated for the message.
344    */
345   unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true );
346
347   /**
348    * @return the current event-buffer index.
349    */
350   BufferIndex GetEventBufferIndex() const
351   {
352     // inlined as its called often from event thread
353     return mSceneGraphBuffers.GetEventBufferIndex();
354   }
355
356   /**
357    * Called by the event-thread to signal that FlushQueue will be called
358    * e.g. when it has finished event processing.
359    */
360   void EventProcessingStarted();
361
362   /**
363    * Flush the set of messages, which were previously stored with QueueMessage().
364    * Calls to this thread-safe method should be minimized, to avoid thread blocking.
365    *
366    * @return True if there are messages to process.
367    */
368   bool FlushQueue();
369
370   /**
371    * Add a new sampler to RenderManager
372    * @param[in] sampler The sampler to add
373    * @post Sends a message to RenderManager to add the sampler.
374    * The sampler will be owned by RenderManager
375    */
376   void AddSampler( Render::Sampler* sampler );
377
378   /**
379    * Removes an existing sampler from RenderManager
380    * @param[in] sampler The sampler to remove
381    * @post The sampler will be destroyed in the render thread
382    */
383   void RemoveSampler( Render::Sampler* sampler );
384
385   /**
386    * Sets the filter modes for an existing sampler
387    * @param[in] sampler The sampler
388    * @param[in] minFilterMode The filter to use under minification
389    * @param[in] magFilterMode The filter to use under magnification
390    */
391   void SetFilterMode( Render::Sampler* sampler, unsigned int minFilterMode, unsigned int magFilterMode );
392
393   /**
394    * Sets the wrap mode for an existing sampler
395    * @param[in] sampler The sampler
396    * @param[in] rWrapMode Wrapping mode in z direction
397    * @param[in] sWrapMode Wrapping mode in x direction
398    * @param[in] tWrapMode Wrapping mode in y direction
399    */
400   void SetWrapMode( Render::Sampler* sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode );
401
402   /**
403    * Add a new property buffer to RenderManager
404    * @param[in] propertryBuffer The property buffer to add
405    * @post Sends a message to RenderManager to add the property buffer.
406    * The property buffer will be owned by RenderManager
407    */
408   void AddPropertyBuffer( Render::PropertyBuffer* propertryBuffer );
409
410   /**
411    * Removes an existing PropertyBuffer from RenderManager
412    * @param[in] propertryBuffer The property buffer to remove
413    * @post The property buffer will be destroyed in the render thread
414    */
415   void RemovePropertyBuffer( Render::PropertyBuffer* propertryBuffer );
416
417   /**
418    * Sets the format of an existing property buffer
419    * @param[in] propertyBuffer The property buffer.
420    * @param[in] format The new format of the buffer
421    * @post Sends a message to RenderManager to set the new format to the property buffer.
422    */
423   void SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format );
424
425   /**
426    * Sets the data of an existing property buffer
427    * @param[in] propertyBuffer The property buffer.
428    * @param[in] data The new data of the buffer
429    * @param[in] size The new size of the buffer
430    * @post Sends a message to RenderManager to set the new data to the property buffer.
431    */
432   void SetPropertyBufferData(Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size);
433
434   /**
435    * Adds a geometry to the RenderManager
436    * @param[in] geometry The geometry to add
437    * @post Sends a message to RenderManager to add the Geometry
438    * The geometry will be owned by RenderManager
439    */
440   void AddGeometry( Render::Geometry* geometry );
441
442   /**
443    * Removes an existing Geometry from RenderManager
444    * @param[in] geometry The geometry to remove
445    * @post The geometry will be destroyed in the render thread
446    */
447   void RemoveGeometry( Render::Geometry* geometry );
448
449   /**
450    * Sets the geometry type of an existing Geometry
451    * @param[in] geometry The geometry
452    * @param[in] geometryType The type of the geometry
453    */
454   void SetGeometryType( Render::Geometry* geometry, unsigned int geometryType );
455
456   /**
457    * Sets the index buffer to be used by a geometry
458    * @param[in] geometry The geometry
459    * @param[in] indices A vector containing the indices for the geometry
460    */
461   void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<unsigned short>& indices );
462
463   /**
464    * Adds a vertex buffer to a geomtry
465    * @param[in] geometry The geometry
466    * @param[in] propertyBuffer The property buffer
467    */
468   void AddVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
469
470   /**
471    * Removes a vertex buffer from a geometry
472    * @param[in] geometry The geometry
473    * @param[in] propertyBuffer The property buffer
474    */
475   void RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
476
477   /**
478    * Adds a texture to the render manager
479    * @param[in] texture The texture to add
480    * The texture will be owned by RenderManager
481    */
482   void AddTexture( Render::NewTexture* texture );
483
484   /**
485    * Removes a texture from the render manager
486    * @param[in] texture The texture to remove
487    * @post The texture will be destroyed in the render thread
488    */
489   void RemoveTexture( Render::NewTexture* texture );
490
491   /**
492    * Uploads data to a texture owned by the RenderManager
493    * @param[in] texture The texture
494    * @param[in] pixelData The pixel data object
495    * @param[in] params The parameters for the upload
496    */
497   void UploadTexture( Render::NewTexture* texture, PixelDataPtr pixelData, const NewTexture::UploadParams& params );
498
499   /**
500    * Generates mipmaps for a texture owned by the RenderManager
501    * @param[in] texture The texture
502    */
503   void GenerateMipmaps( Render::NewTexture* texture );
504
505   /**
506    * Adds a framebuffer to the render manager
507    * @param[in] frameBuffer The framebuffer to add
508    * The framebuffer will be owned by RenderManager
509    */
510   void AddFrameBuffer( Render::FrameBuffer* frameBuffer );
511
512   /**
513    * Removes a FrameBuffer from the render manager
514    * @param[in] frameBuffer The FrameBuffer to remove
515    * @post The FrameBuffer will be destroyed in the render thread
516    */
517   void RemoveFrameBuffer( Render::FrameBuffer* frameBuffer );
518
519   /**
520    * Attach a texture as color output to an existing FrameBuffer
521    * @param[in] frameBuffer The FrameBuffer
522    * @param[in] texture The texture that will be used as output when rendering
523    * @param[in] mipmapLevel The mipmap of the texture to be attached
524    * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
525    */
526   void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int face );
527
528 public:
529
530   /**
531    * Performs an Update traversal on the scene-graph.
532    * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
533    * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
534    * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
535    * @return True if further updates are required e.g. during animations.
536    */
537   unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
538
539   /**
540    * Set the background color i.e. the glClear color used at the beginning of each frame.
541    * @param[in] color The new background color.
542    */
543   void SetBackgroundColor(const Vector4& color);
544
545   /**
546    * Set the default surface rect.
547    * @param[in] rect The rect value representing the surface.
548    */
549   void SetDefaultSurfaceRect( const Rect<int>& rect );
550
551   /**
552    * @copydoc Dali::Stage::KeepRendering()
553    */
554   void KeepRendering( float durationSeconds );
555
556   /**
557    * Sets the depths of all layers.
558    * @param layers The layers in depth order.
559    * @param[in] systemLevel True if using the system-level overlay.
560    */
561   void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
562
563 private:
564
565   // Undefined
566   UpdateManager(const UpdateManager&);
567
568   // Undefined
569   UpdateManager& operator=(const UpdateManager& rhs);
570
571   /**
572    * Helper to check whether the update-thread should keep going.
573    * @param[in] elapsedSeconds The time in seconds since the previous update.
574    * @return True if the update-thread should keep going.
575    */
576   unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
577
578   /**
579    * Post process resources that have been updated by renderer
580    */
581   void PostProcessResources();
582
583   /**
584    * Helper to reset all Node properties
585    * @param[in] bufferIndex to use
586    */
587   void ResetProperties( BufferIndex bufferIndex );
588
589   /**
590    * Perform gesture updates.
591    * @param[in] bufferIndex to use
592    * @param[in] lastVSyncTime  The last VSync time in milliseconds.
593    * @param[in] nextVSyncTime  The estimated time of the next VSync in milliseconds.
594    * @return true, if any properties were updated.
595    */
596   bool ProcessGestures( BufferIndex bufferIndex, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
597
598   /**
599    * Perform animation updates
600    * @param[in] bufferIndex to use
601    * @param[in] elapsedSeconds time since last frame
602    */
603   void Animate( BufferIndex bufferIndex, float elapsedSeconds );
604
605   /**
606    * Applies constraints to CustomObjects
607    * @param[in] bufferIndex to use
608    */
609   void ConstrainCustomObjects( BufferIndex bufferIndex );
610
611   /**
612    * Applies constraints to RenderTasks
613    * @param[in] bufferIndex to use
614    */
615   void ConstrainRenderTasks( BufferIndex bufferIndex );
616
617   /**
618    * Applies constraints to Shaders
619    * @param[in] bufferIndex to use
620    */
621   void ConstrainShaders( BufferIndex bufferIndex );
622
623   /**
624    * Perform property notification updates
625    * @param[in] bufferIndex to use
626    */
627   void ProcessPropertyNotifications( BufferIndex bufferIndex );
628
629   /**
630    * Prepare textures for rendering
631    */
632   void PrepareTextureSets( BufferIndex bufferIndex );
633
634   /**
635    * Pass shader binaries queued here on to event thread.
636    */
637   void ForwardCompiledShadersToEventThread();
638
639   /**
640    * Update node shaders, opacity, geometry etc.
641    * @param[in] bufferIndex to use
642    */
643   void UpdateNodes( BufferIndex bufferIndex );
644
645   /**
646    * Update Renderers
647    * @param[in] bufferIndex to use
648    */
649   void UpdateRenderers( BufferIndex bufferIndex );
650
651 private:
652
653   // needs to be direct member so that getter for event buffer can be inlined
654   SceneGraphBuffers mSceneGraphBuffers;
655
656   struct Impl;
657   Impl* mImpl;
658
659 };
660
661 // Messages for UpdateManager
662
663 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
664 {
665   typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
666
667   // Reserve some memory inside the message queue
668   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
669
670   // Construct message in the message queue memory; note that delete should not be called on the return value
671   new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
672 }
673
674 inline void AddNodeMessage( UpdateManager& manager, Node& node )
675 {
676   typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
677
678   // Reserve some memory inside the message queue
679   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
680
681   // Construct message in the message queue memory; note that delete should not be called on the return value
682   new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
683 }
684
685 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
686 {
687   // Update thread can edit the object
688   Node& parent = const_cast< Node& >( constParent );
689   Node& child = const_cast< Node& >( constChild );
690
691   typedef MessageValue2< UpdateManager, Node*, Node* > LocalType;
692
693   // Reserve some memory inside the message queue
694   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
695
696   // Construct message in the message queue memory; note that delete should not be called on the return value
697   new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
698 }
699
700 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
701 {
702   // Scene graph thread can modify this object.
703   Node& node = const_cast< Node& >( constNode );
704
705   typedef MessageValue1< UpdateManager, Node* > LocalType;
706
707   // Reserve some memory inside the message queue
708   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
709
710   // Construct message in the message queue memory; note that delete should not be called on the return value
711   new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
712 }
713
714 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
715 {
716   // Scene graph thread can destroy this object.
717   Node& node = const_cast< Node& >( constNode );
718
719   typedef MessageValue1< UpdateManager, Node* > LocalType;
720
721   // Reserve some memory inside the message queue
722   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
723
724   // Construct message in the message queue memory; note that delete should not be called on the return value
725   new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
726 }
727
728 inline void AddCameraMessage( UpdateManager& manager, const Camera* constCamera )
729 {
730   typedef MessageValue1< UpdateManager, Camera* > LocalType;
731
732   Camera* camera = const_cast<Camera*>( constCamera );
733   // Reserve some memory inside the message queue
734   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
735
736   // Construct message in the message queue memory; note that delete should not be called on the return value
737   new (slot) LocalType( &manager, &UpdateManager::AddCamera, camera );
738 }
739
740 inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera )
741 {
742   typedef MessageValue1< UpdateManager, const Camera* > LocalType;
743
744   // Reserve some memory inside the message queue
745   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
746
747   // Construct message in the message queue memory; note that delete should not be called on the return value
748   new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, camera );
749 }
750
751 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
752 {
753   typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
754
755   // Reserve some memory inside the message queue
756   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
757
758   // Construct message in the message queue memory; note that delete should not be called on the return value
759   new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
760 }
761
762 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
763 {
764   typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
765
766   // Reserve some memory inside the message queue
767   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
768
769   // Construct message in the message queue memory; note that delete should not be called on the return value
770   new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
771 }
772
773 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
774 {
775   typedef MessageValue1< UpdateManager, Animation* > LocalType;
776
777   // Reserve some memory inside the message queue
778   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
779
780   // Construct message in the message queue memory; note that delete should not be called on the return value
781   new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
782 }
783
784 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
785 {
786   // The scene-graph thread owns this object so it can safely edit it.
787   Animation& animation = const_cast< Animation& >( constAnimation );
788
789   typedef MessageValue1< UpdateManager, Animation* > LocalType;
790
791   // Reserve some memory inside the message queue
792   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
793
794   // Construct message in the message queue memory; note that delete should not be called on the return value
795   new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
796 }
797
798 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
799 {
800   // The scene-graph thread owns this object so it can safely edit it.
801   Animation& animation = const_cast< Animation& >( constAnimation );
802
803   typedef MessageValue1< UpdateManager, Animation* > LocalType;
804
805   // Reserve some memory inside the message queue
806   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
807
808   // Construct message in the message queue memory; note that delete should not be called on the return value
809   new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
810 }
811
812 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
813 {
814   typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
815
816   // Reserve some memory inside the message queue
817   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
818
819   // Construct message in the message queue memory; note that delete should not be called on the return value
820   new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
821 }
822
823 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
824 {
825   // The scene-graph thread owns this object so it can safely edit it.
826   PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
827
828   typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
829
830   // Reserve some memory inside the message queue
831   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
832
833   // Construct message in the message queue memory; note that delete should not be called on the return value
834   new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
835 }
836
837 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
838                                                       const PropertyNotification* constPropertyNotification,
839                                                       PropertyNotification::NotifyMode notifyMode )
840 {
841   // The scene-graph thread owns this object so it can safely edit it.
842   PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
843
844   typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
845
846   // Reserve some memory inside the message queue
847   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
848
849   // Construct message in the message queue memory; note that delete should not be called on the return value
850   new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
851 }
852
853 // The render thread can safely change the Shader
854 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
855 {
856   typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
857
858   // Reserve some memory inside the message queue
859   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
860
861   // Construct message in the message queue memory; note that delete should not be called on the return value
862   new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
863 }
864
865 // The render thread can safely change the Shader
866 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
867 {
868   typedef MessageValue1< UpdateManager, Shader* > LocalType;
869
870   // Reserve some memory inside the message queue
871   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
872
873   // Construct message in the message queue memory; note that delete should not be called on the return value
874   new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
875 }
876
877 inline void SetShaderProgramMessage( UpdateManager& manager,
878                                      Shader& shader,
879                                      Internal::ShaderDataPtr shaderData,
880                                      bool modifiesGeometry )
881 {
882   typedef MessageValue3< UpdateManager, Shader*, Internal::ShaderDataPtr, bool > LocalType;
883
884   // Reserve some memory inside the message queue
885   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
886
887   // Construct message in the message queue memory; note that delete should not be called on the return value
888   new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, shaderData, modifiesGeometry );
889 }
890
891 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
892 {
893   typedef MessageValue1< UpdateManager, Vector4 > LocalType;
894
895   // Reserve some memory inside the message queue
896   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
897
898   // Construct message in the message queue memory; note that delete should not be called on the return value
899   new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
900 }
901
902 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect  )
903 {
904   typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
905
906   // Reserve some memory inside the message queue
907   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
908
909   // Construct message in the message queue memory; note that delete should not be called on the return value
910   new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
911 }
912
913 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
914 {
915   typedef MessageValue1< UpdateManager, float > LocalType;
916
917   // Reserve some memory inside the message queue
918   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
919
920   // Construct message in the message queue memory; note that delete should not be called on the return value
921   new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
922 }
923
924 /**
925  * Create a message for setting the depth of a layer
926  * @param[in] manager The update manager
927  * @param[in] layers list of layers
928  * @param[in] systemLevel True if the layers are added via the SystemOverlay API
929  */
930 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
931 {
932   typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
933
934   // Reserve some memory inside the message queue
935   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
936
937   // Construct message in the message queue memory; note that delete should not be called on the return value
938   new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
939 }
940
941 inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
942 {
943   typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
944
945   // Reserve some memory inside the message queue
946   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
947
948   // Construct message in the message queue memory; note that delete should not be called on the return value
949   new (slot) LocalType( &manager, &UpdateManager::AddGesture, gesture );
950 }
951
952 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
953 {
954   typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
955
956   // Reserve some memory inside the message queue
957   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
958
959   // Construct message in the message queue memory; note that delete should not be called on the return value
960   new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture );
961 }
962
963 template< typename T >
964 inline void AddMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
965 {
966   typedef MessageValue1< ObjectOwnerContainer<T>, OwnerPointer< T > > LocalType;
967
968   // Reserve some memory inside the message queue
969   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
970   // Construct message in the message queue memory; note that delete should not be called on the return value
971   new (slot) LocalType( &owner, &ObjectOwnerContainer<T>::Add, &object );
972 }
973
974 template< typename T >
975 inline void RemoveMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
976 {
977   typedef MessageValue1< ObjectOwnerContainer<T>, T* > LocalType;
978
979   // Reserve some memory inside the message queue
980   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
981   // Construct message in the message queue memory; note that delete should not be called on the return value
982   new (slot) LocalType( &owner, &ObjectOwnerContainer<T>::Remove, &object );
983 }
984
985 // The render thread can safely change the Shader
986 inline void AddTextureSetMessage( UpdateManager& manager, TextureSet& textureSet )
987 {
988   typedef MessageValue1< UpdateManager, OwnerPointer< TextureSet > > LocalType;
989
990   // Reserve some memory inside the message queue
991   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
992
993   // Construct message in the message queue memory; note that delete should not be called on the return value
994   new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, &textureSet );
995 }
996
997 // The render thread can safely change the Shader
998 inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& textureSet )
999 {
1000   typedef MessageValue1< UpdateManager, TextureSet* > LocalType;
1001
1002   // Reserve some memory inside the message queue
1003   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1004
1005   // Construct message in the message queue memory; note that delete should not be called on the return value
1006   new (slot) LocalType( &manager, &UpdateManager::RemoveTextureSet, &textureSet );
1007 }
1008
1009 inline void AddSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
1010 {
1011   typedef MessageValue1< UpdateManager, Render::Sampler* > LocalType;
1012
1013   // Reserve some memory inside the message queue
1014   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1015
1016   // Construct message in the message queue memory; note that delete should not be called on the return value
1017   new (slot) LocalType( &manager, &UpdateManager::AddSampler, &sampler );
1018 }
1019
1020 inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
1021 {
1022   typedef MessageValue1< UpdateManager, Render::Sampler* > LocalType;
1023
1024   // Reserve some memory inside the message queue
1025   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1026
1027   // Construct message in the message queue memory; note that delete should not be called on the return value
1028   new (slot) LocalType( &manager, &UpdateManager::RemoveSampler, &sampler );
1029 }
1030
1031 inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, unsigned int minFilterMode, unsigned int magFilterMode )
1032 {
1033   typedef MessageValue3< UpdateManager, Render::Sampler*, unsigned int, unsigned int > LocalType;
1034
1035   // Reserve some memory inside the message queue
1036   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1037
1038   // Construct message in the message queue memory; note that delete should not be called on the return value
1039   new (slot) LocalType( &manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode );
1040 }
1041
1042 inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode )
1043 {
1044   typedef MessageValue4< UpdateManager, Render::Sampler*, unsigned int, unsigned int, unsigned int > LocalType;
1045
1046   // Reserve some memory inside the message queue
1047   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1048
1049   // Construct message in the message queue memory; note that delete should not be called on the return value
1050   new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode );
1051 }
1052
1053 inline void AddPropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer )
1054 {
1055   typedef MessageValue1< UpdateManager, Render::PropertyBuffer*  > LocalType;
1056
1057   // Reserve some memory inside the message queue
1058   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1059
1060   // Construct message in the message queue memory; note that delete should not be called on the return value
1061   new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, &propertyBuffer );
1062 }
1063
1064 inline void RemovePropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer )
1065 {
1066   typedef MessageValue1< UpdateManager, Render::PropertyBuffer*  > LocalType;
1067
1068   // Reserve some memory inside the message queue
1069   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1070
1071   // Construct message in the message queue memory; note that delete should not be called on the return value
1072   new (slot) LocalType( &manager, &UpdateManager::RemovePropertyBuffer, &propertyBuffer );
1073 }
1074
1075 inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Render::PropertyBuffer::Format* format )
1076 {
1077   typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, Render::PropertyBuffer::Format*  > LocalType;
1078
1079   // Reserve some memory inside the message queue
1080   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1081
1082   // Construct message in the message queue memory; note that delete should not be called on the return value
1083   new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferFormat, &propertyBuffer, format );
1084 }
1085
1086 inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Vector<char>* data, size_t size )
1087 {
1088   typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, Vector<char>*, size_t  > LocalType;
1089
1090   // Reserve some memory inside the message queue
1091   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1092
1093   // Construct message in the message queue memory; note that delete should not be called on the return value
1094   new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data, size );
1095 }
1096
1097 inline void AddGeometry( UpdateManager& manager, Render::Geometry& geometry )
1098 {
1099   typedef MessageValue1< UpdateManager, Render::Geometry*  > LocalType;
1100
1101   // Reserve some memory inside the message queue
1102   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1103
1104   // Construct message in the message queue memory; note that delete should not be called on the return value
1105   new (slot) LocalType( &manager, &UpdateManager::AddGeometry, &geometry );
1106 }
1107
1108 inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry )
1109 {
1110   typedef MessageValue1< UpdateManager, Render::Geometry*  > LocalType;
1111
1112   // Reserve some memory inside the message queue
1113   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1114
1115   // Construct message in the message queue memory; note that delete should not be called on the return value
1116   new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry );
1117 }
1118
1119 inline void AddVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
1120 {
1121   typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
1122
1123   // Reserve some memory inside the message queue
1124   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1125
1126   // Construct message in the message queue memory; note that delete should not be called on the return value
1127   new (slot) LocalType( &manager, &UpdateManager::AddVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
1128 }
1129
1130 inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
1131 {
1132   typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
1133
1134   // Reserve some memory inside the message queue
1135   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1136
1137   // Construct message in the message queue memory; note that delete should not be called on the return value
1138   new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
1139 }
1140
1141 // Custom message type for SetIndexBuffer() used to move data with Vector::Swap()
1142 template< typename T >
1143 class IndexBufferMessage : public MessageBase
1144 {
1145 public:
1146
1147   /**
1148    * Constructor which does a Vector::Swap()
1149    */
1150   IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector<unsigned short>& indices )
1151   : MessageBase(),
1152     mManager( manager ),
1153     mRenderGeometry( geometry )
1154   {
1155     mIndices.Swap( indices );
1156   }
1157
1158   /**
1159    * Virtual destructor
1160    */
1161   virtual ~IndexBufferMessage()
1162   {
1163   }
1164
1165   /**
1166    * @copydoc MessageBase::Process
1167    */
1168   virtual void Process( BufferIndex /*bufferIndex*/ )
1169   {
1170     DALI_ASSERT_DEBUG( mManager && "Message does not have an object" );
1171     mManager->SetIndexBuffer( mRenderGeometry, mIndices );
1172   }
1173
1174 private:
1175
1176   T* mManager;
1177   Render::Geometry* mRenderGeometry;
1178   Dali::Vector<unsigned short> mIndices;
1179 };
1180
1181 inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<unsigned short>& indices )
1182 {
1183   typedef IndexBufferMessage< UpdateManager > LocalType;
1184
1185   // Reserve some memory inside the message queue
1186   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1187
1188   // Construct message in the message queue memory; note that delete should not be called on the return value
1189   new (slot) LocalType( &manager, &geometry, indices );
1190 }
1191
1192 inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, unsigned int geometryType )
1193 {
1194   typedef MessageValue2< UpdateManager, Render::Geometry*, unsigned int > LocalType;
1195
1196   // Reserve some memory inside the message queue
1197   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1198
1199   // Construct message in the message queue memory; note that delete should not be called on the return value
1200   new (slot) LocalType( &manager, &UpdateManager::SetGeometryType, &geometry, geometryType );
1201 }
1202
1203 inline void AddTexture( UpdateManager& manager, Render::NewTexture& texture )
1204 {
1205   typedef MessageValue1< UpdateManager, Render::NewTexture*  > LocalType;
1206
1207   // Reserve some memory inside the message queue
1208   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1209
1210   // Construct message in the message queue memory; note that delete should not be called on the return value
1211   new (slot) LocalType( &manager, &UpdateManager::AddTexture, &texture );
1212 }
1213
1214 inline void RemoveTexture( UpdateManager& manager, Render::NewTexture& texture )
1215 {
1216   typedef MessageValue1< UpdateManager, Render::NewTexture*  > LocalType;
1217
1218   // Reserve some memory inside the message queue
1219   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1220
1221   // Construct message in the message queue memory; note that delete should not be called on the return value
1222   new (slot) LocalType( &manager, &UpdateManager::RemoveTexture, &texture );
1223 }
1224
1225 inline void UploadTextureMessage( UpdateManager& manager, Render::NewTexture& texture, PixelDataPtr pixelData, const NewTexture::UploadParams& params )
1226 {
1227   typedef MessageValue3< UpdateManager, Render::NewTexture*, PixelDataPtr, NewTexture::UploadParams > LocalType;
1228
1229   // Reserve some memory inside the message queue
1230   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1231
1232   // Construct message in the message queue memory; note that delete should not be called on the return value
1233   new (slot) LocalType( &manager, &UpdateManager::UploadTexture, &texture, pixelData, params );
1234 }
1235
1236 inline void GenerateMipmapsMessage( UpdateManager& manager, Render::NewTexture& texture )
1237 {
1238   typedef MessageValue1< UpdateManager, Render::NewTexture*  > LocalType;
1239
1240   // Reserve some memory inside the message queue
1241   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1242
1243   // Construct message in the message queue memory; note that delete should not be called on the return value
1244   new (slot) LocalType( &manager, &UpdateManager::GenerateMipmaps, &texture );
1245 }
1246
1247
1248 inline void AddFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
1249 {
1250   typedef MessageValue1< UpdateManager, Render::FrameBuffer*  > LocalType;
1251
1252   // Reserve some memory inside the message queue
1253   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1254
1255   // Construct message in the message queue memory; note that delete should not be called on the return value
1256   new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, &frameBuffer );
1257 }
1258
1259 inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
1260 {
1261   typedef MessageValue1< UpdateManager, Render::FrameBuffer*  > LocalType;
1262
1263   // Reserve some memory inside the message queue
1264   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1265
1266   // Construct message in the message queue memory; note that delete should not be called on the return value
1267   new (slot) LocalType( &manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer );
1268 }
1269
1270 inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer )
1271 {
1272   typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::NewTexture*, unsigned int, unsigned int  > LocalType;
1273
1274   // Reserve some memory inside the message queue
1275   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1276
1277   // Construct message in the message queue memory; note that delete should not be called on the return value
1278   new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
1279 }
1280
1281 } // namespace SceneGraph
1282
1283 } // namespace Internal
1284
1285 } // namespace Dali
1286
1287 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__