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