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