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