1 #ifndef DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
2 #define DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/common/dali-common.h>
25 #include <dali/devel-api/common/stage-devel.h>
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/property-resetter.h>
33 #include <dali/internal/update/common/scene-graph-buffers.h>
34 #include <dali/internal/update/common/scene-graph-property-notification.h>
35 #include <dali/internal/update/common/scene-graph-scene.h>
36 #include <dali/internal/update/nodes/node.h>
37 #include <dali/internal/update/nodes/scene-graph-layer.h>
38 #include <dali/internal/update/manager/scene-graph-frame-callback.h> // for OwnerPointer< FrameCallback >
39 #include <dali/internal/update/rendering/scene-graph-renderer.h> // for OwnerPointer< Renderer >
40 #include <dali/internal/update/rendering/scene-graph-texture-set.h> // for OwnerPointer< TextureSet >
41 #include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
42 #include <dali/internal/update/render-tasks/scene-graph-camera.h>
43 #include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
44 #include <dali/internal/render/shaders/scene-graph-shader.h> // for OwnerPointer< Shader >
45 #include <dali/internal/render/renderers/render-property-buffer.h>
46 #include <dali/internal/event/rendering/texture-impl.h>
51 class FrameCallbackInterface;
55 class GlSyncAbstraction;
56 class RenderController;
58 } // namespace Integration
63 class PropertyNotifier;
64 class NotificationManager;
65 class CompleteNotificationInterface;
73 // value types used by messages
74 template <> struct ParameterType< PropertyNotification::NotifyMode >
75 : public BasicType< PropertyNotification::NotifyMode > {};
84 class RenderTaskProcessor;
90 SceneGraph::Node* node;
92 NodeDepthPair( SceneGraph::Node* node, uint32_t sortedDepth )
94 sortedDepth(sortedDepth)
105 void Add( SceneGraph::Node* node, uint32_t sortedDepth )
107 nodeDepths.push_back( NodeDepthPair( node, sortedDepth ) );
110 std::vector<NodeDepthPair> nodeDepths;
115 * UpdateManager maintains a scene graph i.e. a tree of nodes as well as
116 * other scene graph property owning objects.
117 * It controls the Update traversal, in which nodes are repositioned/animated,
118 * and organizes the the culling and rendering of the scene.
119 * It also maintains the lifecycle of nodes and other property owners that are
120 * disconnected from the scene graph.
122 class UpdateManager : public ShaderSaver
127 * Construct a new UpdateManager.
128 * @param[in] notificationManager This should be notified when animations have finished.
129 * @param[in] animationPlaylist The CompleteNotificationInterface that handles the animations
130 * @param[in] propertyNotifier The PropertyNotifier
131 * @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
132 * @param[in] controller After messages are flushed, we request a render from the RenderController.
133 * @param[in] renderManager This is responsible for rendering the results of each "update".
134 * @param[in] renderQueue Used to queue messages for the next render.
135 * @param[in] renderTaskProcessor Handles RenderTasks and RenderInstrucitons.
137 UpdateManager( NotificationManager& notificationManager,
138 CompleteNotificationInterface& animationPlaylist,
139 PropertyNotifier& propertyNotifier,
140 DiscardQueue& discardQueue,
141 Integration::RenderController& controller,
142 RenderManager& renderManager,
143 RenderQueue& renderQueue,
144 RenderTaskProcessor& renderTaskProcessor );
149 virtual ~UpdateManager();
151 // Node connection methods
154 * Installs a new layer as the root node.
155 * @pre The layer is of derived Node type Layer.
156 * @pre The layer does not have a parent.
157 * @param[in] layer The new root node.
158 * @post The node is owned by UpdateManager.
160 void InstallRoot( OwnerPointer<Layer>& layer );
163 * Uninstalls the root node.
164 * @pre The layer is of derived Node type Layer.
165 * @pre The layer does not have a parent.
166 * @param[in] layer The root node.
167 * @post The node is owned by UpdateManager.
169 void UninstallRoot( Layer* layer );
172 * Add a Node; UpdateManager takes ownership.
173 * @pre The node does not have a parent.
174 * @note even though nodes are pool allocated, they also contain other heap allocated data, thus using OwnerPointer when transferring the data
175 * @param[in] node The node to add.
177 void AddNode( OwnerPointer<Node>& node );
180 * Connect a Node to the scene-graph.
181 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
182 * @pre The node does not already have a parent.
183 * @param[in] parent The new parent node.
185 void ConnectNode( Node* parent, Node* node );
188 * Disconnect a Node from the scene-graph.
189 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
190 * @pre The node has a parent.
191 * @param[in] node The node to disconnect.
193 void DisconnectNode( Node* node );
196 * Destroy a Node owned by UpdateManager.
197 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
198 * In the following update, the previously queued Nodes may be deleted.
199 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
200 * @param[in] node The node to destroy.
202 void DestroyNode( Node* node );
205 * Add a camera on scene
206 * @param[in] camera The camera to add
208 void AddCamera( OwnerPointer< Camera >& camera );
211 * Remove a camera from scene
212 * @param[in] camera to remove
214 void RemoveCamera( Camera* camera );
217 * Add a newly created object.
218 * @param[in] object The object to add.
219 * @post The object is owned by UpdateManager.
221 void AddObject( OwnerPointer<PropertyOwner>& object );
225 * @param[in] object The object to remove.
227 void RemoveObject( PropertyOwner* object );
230 * Add a newly created render task list.
231 * @param[in] taskList The render task list to add.
232 * @post The render task list is owned by UpdateManager.
234 void AddRenderTaskList( OwnerPointer<RenderTaskList>& taskList );
237 * Remove a render task list.
238 * @param[in] taskList The render task list to remove.
240 void RemoveRenderTaskList( RenderTaskList* taskList );
243 * Add a newly created scene.
244 * @param[in] scene The scene to add.
245 * @post The scene is owned by UpdateManager.
247 void AddScene( OwnerPointer<Scene>& scene );
251 * @param[in] scene The scene to remove.
253 void RemoveScene( Scene* scene );
258 * Add a newly created animation.
259 * @param[in] animation The animation to add.
260 * @post The animation is owned by UpdateManager.
262 void AddAnimation( OwnerPointer< SceneGraph::Animation >& animation );
266 * @param[in] animation The animation to stop.
268 void StopAnimation( Animation* animation );
271 * Remove an animation.
272 * @param[in] animation The animation to remove.
274 void RemoveAnimation( Animation* animation );
277 * Query whether any animations are currently running.
278 * @return True if any animations are running.
280 bool IsAnimationRunning() const;
283 * Add a property resetter. UpdateManager takes ownership of the object.
284 * It will be killed by UpdateManager when the associated animator or
285 * constraint has finished; or the property owner of the property is destroyed.
287 void AddPropertyResetter( OwnerPointer<PropertyResetterBase>& propertyResetter );
289 // Property Notification
292 * Add a newly created property notification
293 * @param[in] propertyNotification The notification to add
294 * @post The propertyNotification is owned by UpdateManager.
296 void AddPropertyNotification( OwnerPointer< PropertyNotification >& propertyNotification );
299 * Remove a property notification
300 * @param[in] propertyNotification The notification to remove
302 void RemovePropertyNotification( PropertyNotification* propertyNotification );
305 * Set Notify state for PropertyNotification
306 * @param[in] propertyNotification The notification to remove
307 * @param[in] notifyMode The notification mode.
309 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
314 * Add a newly created shader.
315 * @param[in] shader The shader to add.
316 * @post The shader is owned by the UpdateManager.
318 void AddShader( OwnerPointer< Shader >& shader );
322 * @pre The shader has been added to the UpdateManager.
323 * @param[in] shader The shader to remove.
324 * @post The shader is destroyed.
326 void RemoveShader( Shader* shader );
329 * Set the shader program for a Shader object
330 * @param[in] shader The shader to modify
331 * @param[in] shaderData Source code, hash over source, and optional compiled binary for the shader program
332 * @param[in] modifiesGeometry True if the vertex shader modifies geometry
334 void SetShaderProgram( Shader* shader, Internal::ShaderDataPtr shaderData, bool modifiesGeometry );
337 * @brief Accept compiled shaders passed back on render thread for saving.
338 * @param[in] shaderData Source code, hash over source, and corresponding compiled binary to be saved.
340 virtual void SaveBinary( Internal::ShaderDataPtr shaderData );
343 * @brief Set the destination for compiled shader binaries to be passed on to.
344 * The dispatcher passed in will be called from the update thread.
345 * @param[in] upstream A sink for ShaderDatas to be passed into.
347 void SetShaderSaver( ShaderSaver& upstream );
352 * Add a new renderer to scene
353 * @param renderer to add
355 void AddRenderer( OwnerPointer< Renderer >& renderer );
358 * Add a renderer from scene
359 * @param renderer to remove
361 void RemoveRenderer( Renderer* renderer );
366 * Set the pan gesture processor.
367 * Pan Gesture processor lives for the lifetime of UpdateManager
368 * @param[in] gesture The gesture processor.
369 * @post The gestureProcessor is owned by the UpdateManager.
371 void SetPanGestureProcessor( PanGesture* gestureProcessor );
376 * Add a newly created TextureSet.
377 * @param[in] textureSet The texture set to add.
378 * @post The TextureSet is owned by the UpdateManager.
380 void AddTextureSet( OwnerPointer< TextureSet >& textureSet );
383 * Remove a TextureSet.
384 * @pre The TextureSet has been added to the UpdateManager.
385 * @param[in] textureSet The TextureSet to remove.
386 * @post The TextureSet is destroyed.
388 void RemoveTextureSet( TextureSet* textureSet );
393 * Get the scene graph side list of RenderTasks.
394 * @param[in] systemLevel True if using the system-level overlay.
395 * @return The list of render tasks
397 RenderTaskList* GetRenderTaskList( bool systemLevel );
399 // Message queue handling
402 * Reserve space for another message in the queue; this must then be initialized by the caller.
403 * The message will be read from the update-thread after the next FlushMessages is called.
404 * @post Calling this method may invalidate any previously returned slots.
405 * @param[in] size The message size with respect to the size of type "char".
406 * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
407 * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
408 * @return A pointer to the first char allocated for the message.
410 uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene = true );
413 * @return the current event-buffer index.
415 BufferIndex GetEventBufferIndex() const
417 // inlined as its called often from event thread
418 return mSceneGraphBuffers.GetEventBufferIndex();
422 * Called by the event-thread to signal that FlushQueue will be called
423 * e.g. when it has finished event processing.
425 void EventProcessingStarted();
428 * Flush the set of messages, which were previously stored with QueueMessage().
429 * Calls to this thread-safe method should be minimized, to avoid thread blocking.
431 * @return True if there are messages to process.
436 * Add a new sampler to RenderManager
437 * @param[in] sampler The sampler to add
438 * @post Sends a message to RenderManager to add the sampler.
439 * The sampler will be owned by RenderManager
441 void AddSampler( OwnerPointer< Render::Sampler >& sampler );
444 * Removes an existing sampler from RenderManager
445 * @param[in] sampler The sampler to remove
446 * @post The sampler will be destroyed in the render thread
448 void RemoveSampler( Render::Sampler* sampler );
451 * Sets the filter modes for an existing sampler
452 * @param[in] sampler The sampler
453 * @param[in] minFilterMode The filter to use under minification
454 * @param[in] magFilterMode The filter to use under magnification
456 void SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode );
459 * Sets the wrap mode for an existing sampler
460 * @param[in] sampler The sampler
461 * @param[in] rWrapMode Wrapping mode in z direction
462 * @param[in] sWrapMode Wrapping mode in x direction
463 * @param[in] tWrapMode Wrapping mode in y direction
465 void SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode );
468 * Add a new property buffer to RenderManager
469 * @param[in] propertryBuffer The property buffer to add
470 * @post Sends a message to RenderManager to add the property buffer.
471 * The property buffer will be owned by RenderManager
473 void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertryBuffer );
476 * Removes an existing PropertyBuffer from RenderManager
477 * @param[in] propertryBuffer The property buffer to remove
478 * @post The property buffer will be destroyed in the render thread
480 void RemovePropertyBuffer( Render::PropertyBuffer* propertryBuffer );
483 * Sets the format of an existing property buffer
484 * @param[in] propertyBuffer The property buffer.
485 * @param[in] format The new format of the buffer
486 * @post Sends a message to RenderManager to set the new format to the property buffer.
488 void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format );
491 * Sets the data of an existing property buffer
492 * @param[in] propertyBuffer The property buffer.
493 * @param[in] data The new data of the buffer
494 * @param[in] size The new size of the buffer
495 * @post Sends a message to RenderManager to set the new data to the property buffer.
497 void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size );
500 * Adds a geometry to the RenderManager
501 * @param[in] geometry The geometry to add
502 * @post Sends a message to RenderManager to add the Geometry
503 * The geometry will be owned by RenderManager
505 void AddGeometry( OwnerPointer< Render::Geometry >& geometry );
508 * Removes an existing Geometry from RenderManager
509 * @param[in] geometry The geometry to remove
510 * @post The geometry will be destroyed in the render thread
512 void RemoveGeometry( Render::Geometry* geometry );
515 * Sets the geometry type of an existing Geometry
516 * @param[in] geometry The geometry
517 * @param[in] geometryType The type of the geometry
519 void SetGeometryType( Render::Geometry* geometry, uint32_t geometryType );
522 * Sets the index buffer to be used by a geometry
523 * @param[in] geometry The geometry
524 * @param[in] indices A vector containing the indices for the geometry
526 void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& indices );
529 * Adds a vertex buffer to a geometry
530 * @param[in] geometry The geometry
531 * @param[in] propertyBuffer The property buffer
533 void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
536 * Removes a vertex buffer from a geometry
537 * @param[in] geometry The geometry
538 * @param[in] propertyBuffer The property buffer
540 void RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
543 * Adds a texture to the render manager
544 * @param[in] texture The texture to add
545 * The texture will be owned by RenderManager
547 void AddTexture( OwnerPointer< Render::Texture >& texture );
550 * Removes a texture from the render manager
551 * @param[in] texture The texture to remove
552 * @post The texture will be destroyed in the render thread
554 void RemoveTexture( Render::Texture* texture );
557 * Uploads data to a texture owned by the RenderManager
558 * @param[in] texture The texture
559 * @param[in] pixelData The pixel data object
560 * @param[in] params The parameters for the upload
562 void UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params );
565 * Generates mipmaps for a texture owned by the RenderManager
566 * @param[in] texture The texture
568 void GenerateMipmaps( Render::Texture* texture );
571 * Adds a framebuffer to the render manager
572 * @param[in] frameBuffer The framebuffer to add
573 * The framebuffer will be owned by RenderManager
575 void AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer );
578 * Removes a FrameBuffer from the render manager
579 * @param[in] frameBuffer The FrameBuffer to remove
580 * @post The FrameBuffer will be destroyed in the render thread
582 void RemoveFrameBuffer( Render::FrameBuffer* frameBuffer );
585 * Attach a texture as color output to an existing FrameBuffer
586 * @param[in] frameBuffer The FrameBuffer
587 * @param[in] texture The texture that will be used as output when rendering
588 * @param[in] mipmapLevel The mipmap of the texture to be attached
589 * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
591 void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face );
594 * This is called when the surface of the scene has been replaced.
595 * @param[in] scene The scene.
597 void SurfaceReplaced( Scene* scene );
602 * Performs an Update traversal on the scene-graph.
603 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
604 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
605 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
606 * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
607 * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
608 * @return True if further updates are required e.g. during animations.
610 uint32_t Update( float elapsedSeconds,
611 uint32_t lastVSyncTimeMilliseconds,
612 uint32_t nextVSyncTimeMilliseconds,
613 bool renderToFboEnabled,
614 bool isRenderingToFbo );
617 * Set the default surface rect.
618 * @param[in] rect The rect value representing the surface.
620 void SetDefaultSurfaceRect( const Rect<int>& rect );
623 * Set the default surface orientation.
624 * @param[in] orientation The orientation value representing the surface.
626 void SetDefaultSurfaceOrientation( int orientation );
629 * @copydoc Dali::Stage::KeepRendering()
631 void KeepRendering( float durationSeconds );
634 * @copydoc Dali::DevelStage::SetRenderingBehavior()
636 void SetRenderingBehavior( DevelStage::Rendering renderingBehavior );
639 * Sets the depths of all layers.
640 * @param layers The layers in depth order.
641 * @param[in] rootLayer The root layer of the sorted layers.
643 void SetLayerDepths( const std::vector< Layer* >& layers, const Layer* rootLayer );
646 * Set the depth indices of all nodes (in LayerUI's)
647 * @param[in] nodeDepths A vector of nodes and associated depth indices
649 void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths );
652 * Query wheter the default surface rect is changed or not.
653 * @return true if the default surface rect is changed.
655 bool IsDefaultSurfaceRectChanged();
658 * Adds an implementation of the FrameCallbackInterface.
659 * @param[in] frameCallback An OwnerPointer to the SceneGraph FrameCallback object
660 * @param[in] rootNode A pointer to the root node to apply the FrameCallback to
662 void AddFrameCallback( OwnerPointer< FrameCallback >& frameCallback, const Node* rootNode );
665 * Removes the specified implementation of FrameCallbackInterface.
666 * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to remove.
668 void RemoveFrameCallback( FrameCallbackInterface* frameCallback );
673 UpdateManager(const UpdateManager&);
676 UpdateManager& operator=(const UpdateManager& rhs);
679 * Helper to check whether the update-thread should keep going.
680 * @param[in] elapsedSeconds The time in seconds since the previous update.
681 * @return True if the update-thread should keep going.
683 uint32_t KeepUpdatingCheck( float elapsedSeconds ) const;
686 * Helper to reset all Node properties
687 * @param[in] bufferIndex to use
689 void ResetProperties( BufferIndex bufferIndex );
692 * Perform gesture updates.
693 * @param[in] bufferIndex to use
694 * @param[in] lastVSyncTime The last VSync time in milliseconds.
695 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
696 * @return true, if any properties were updated.
698 bool ProcessGestures( BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds );
701 * Perform animation updates
702 * @param[in] bufferIndex to use
703 * @param[in] elapsedSeconds time since last frame
705 void Animate( BufferIndex bufferIndex, float elapsedSeconds );
708 * Applies constraints to CustomObjects
709 * @param[in] bufferIndex to use
711 void ConstrainCustomObjects( BufferIndex bufferIndex );
714 * Applies constraints to RenderTasks
715 * @param[in] bufferIndex to use
717 void ConstrainRenderTasks( BufferIndex bufferIndex );
720 * Applies constraints to Shaders
721 * @param[in] bufferIndex to use
723 void ConstrainShaders( BufferIndex bufferIndex );
726 * Perform property notification updates
727 * @param[in] bufferIndex to use
729 void ProcessPropertyNotifications( BufferIndex bufferIndex );
732 * Pass shader binaries queued here on to event thread.
734 void ForwardCompiledShadersToEventThread();
737 * Update node shaders, opacity, geometry etc.
738 * @param[in] bufferIndex to use
740 void UpdateNodes( BufferIndex bufferIndex );
744 * @param[in] bufferIndex to use
746 void UpdateRenderers( BufferIndex bufferIndex );
750 // needs to be direct member so that getter for event buffer can be inlined
751 SceneGraphBuffers mSceneGraphBuffers;
758 // Messages for UpdateManager
760 inline void InstallRootMessage( UpdateManager& manager, OwnerPointer<Layer>& root )
762 // Message has ownership of Layer while in transit from event -> update
763 typedef MessageValue1< UpdateManager, OwnerPointer<Layer> > LocalType;
765 // Reserve some memory inside the message queue
766 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
768 // Construct message in the message queue memory; note that delete should not be called on the return value
769 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root );
772 inline void UninstallRootMessage( UpdateManager& manager, const Layer* constRoot )
774 // Scene graph thread can destroy this object.
775 Layer* root = const_cast< Layer* >( constRoot );
777 typedef MessageValue1< UpdateManager, Layer* > LocalType;
779 // Reserve some memory inside the message queue
780 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
782 // Construct message in the message queue memory; note that delete should not be called on the return value
783 new (slot) LocalType( &manager, &UpdateManager::UninstallRoot, root );
786 inline void AddNodeMessage( UpdateManager& manager, OwnerPointer<Node>& node )
788 // Message has ownership of Node while in transit from event -> update
789 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
791 // Reserve some memory inside the message queue
792 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
794 // Construct message in the message queue memory; note that delete should not be called on the return value
795 new (slot) LocalType( &manager, &UpdateManager::AddNode, node );
798 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
800 // Update thread can edit the object
801 Node& parent = const_cast< Node& >( constParent );
802 Node& child = const_cast< Node& >( constChild );
804 typedef MessageValue2< UpdateManager, Node*, Node* > LocalType;
806 // Reserve some memory inside the message queue
807 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
809 // Construct message in the message queue memory; note that delete should not be called on the return value
810 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
813 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
815 // Scene graph thread can modify this object.
816 Node& node = const_cast< Node& >( constNode );
818 typedef MessageValue1< UpdateManager, Node* > LocalType;
820 // Reserve some memory inside the message queue
821 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
823 // Construct message in the message queue memory; note that delete should not be called on the return value
824 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
827 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
829 // Scene graph thread can destroy this object.
830 Node& node = const_cast< Node& >( constNode );
832 typedef MessageValue1< UpdateManager, Node* > LocalType;
834 // Reserve some memory inside the message queue
835 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
837 // Construct message in the message queue memory; note that delete should not be called on the return value
838 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
841 inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& camera )
843 // Message has ownership of Camera while in transit from event -> update
844 typedef MessageValue1< UpdateManager, OwnerPointer< Camera > > LocalType;
846 // Reserve some memory inside the message queue
847 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
849 // Construct message in the message queue memory; note that delete should not be called on the return value
850 new (slot) LocalType( &manager, &UpdateManager::AddCamera, camera );
853 inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera )
855 typedef MessageValue1< UpdateManager, Camera* > LocalType;
857 // Reserve some memory inside the message queue
858 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
860 // Construct message in the message queue memory; note that delete should not be called on the return value
861 new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, const_cast<Camera*>( camera ) );
864 inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner>& object )
866 // Message has ownership of object while in transit from event -> update
867 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
869 // Reserve some memory inside the message queue
870 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
872 // Construct message in the message queue memory; note that delete should not be called on the return value
873 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
876 inline void RemoveObjectMessage( UpdateManager& manager, const PropertyOwner* object )
878 typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
880 // Reserve some memory inside the message queue
881 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
883 // Construct message in the message queue memory; note that delete should not be called on the return value
884 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, const_cast<PropertyOwner*>( object ) );
887 inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation )
889 typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::Animation > > LocalType;
891 // Reserve some memory inside the message queue
892 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
894 // Construct message in the message queue memory; note that delete should not be called on the return value
895 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
898 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
900 // The scene-graph thread owns this object so it can safely edit it.
901 Animation& animation = const_cast< Animation& >( constAnimation );
903 typedef MessageValue1< UpdateManager, Animation* > LocalType;
905 // Reserve some memory inside the message queue
906 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
908 // Construct message in the message queue memory; note that delete should not be called on the return value
909 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
912 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
914 // The scene-graph thread owns this object so it can safely edit it.
915 Animation& animation = const_cast< Animation& >( constAnimation );
917 typedef MessageValue1< UpdateManager, Animation* > LocalType;
919 // Reserve some memory inside the message queue
920 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
922 // Construct message in the message queue memory; note that delete should not be called on the return value
923 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
926 inline void AddRenderTaskListMessage( UpdateManager& manager, OwnerPointer< SceneGraph::RenderTaskList >& taskList )
928 typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::RenderTaskList > > LocalType;
930 // Reserve some memory inside the message queue
931 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
933 // Construct message in the message queue memory; note that delete should not be called on the return value
934 new (slot) LocalType( &manager, &UpdateManager::AddRenderTaskList, taskList );
937 inline void RemoveRenderTaskListMessage( UpdateManager& manager, const RenderTaskList& constTaskList )
939 // The scene-graph thread owns this object so it can safely edit it.
940 RenderTaskList& taskList = const_cast< RenderTaskList& >( constTaskList );
942 typedef MessageValue1< UpdateManager, RenderTaskList* > LocalType;
944 // Reserve some memory inside the message queue
945 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
947 // Construct message in the message queue memory; note that delete should not be called on the return value
948 new (slot) LocalType( &manager, &UpdateManager::RemoveRenderTaskList, &taskList );
951 inline void AddSceneMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Scene >& scene )
953 typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::Scene > > LocalType;
955 // Reserve some memory inside the message queue
956 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
958 // Construct message in the message queue memory; note that delete should not be called on the return value
959 new (slot) LocalType( &manager, &UpdateManager::AddScene, scene );
962 inline void RemoveSceneMessage( UpdateManager& manager, const SceneGraph::Scene& constScene )
964 // The scene-graph thread owns this object so it can safely edit it.
965 Scene& scene = const_cast< Scene& >( constScene );
967 typedef MessageValue1< UpdateManager, Scene* > LocalType;
969 // Reserve some memory inside the message queue
970 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
972 // Construct message in the message queue memory; note that delete should not be called on the return value
973 new (slot) LocalType( &manager, &UpdateManager::RemoveScene, &scene );
976 inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification )
978 // Message has ownership of PropertyNotification while in transit from event -> update
979 typedef MessageValue1< UpdateManager, OwnerPointer< PropertyNotification > > LocalType;
981 // Reserve some memory inside the message queue
982 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
984 // Construct message in the message queue memory; note that delete should not be called on the return value
985 new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
988 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
990 // The scene-graph thread owns this object so it can safely edit it.
991 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
993 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
995 // Reserve some memory inside the message queue
996 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
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::RemovePropertyNotification, &propertyNotification );
1002 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
1003 const PropertyNotification* constPropertyNotification,
1004 PropertyNotification::NotifyMode notifyMode )
1006 // The scene-graph thread owns this object so it can safely edit it.
1007 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
1009 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
1011 // Reserve some memory inside the message queue
1012 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
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::PropertyNotificationSetNotify, propertyNotification, notifyMode );
1018 // The render thread can safely change the Shader
1019 inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& shader )
1021 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
1023 // Reserve some memory inside the message queue
1024 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1026 // Construct message in the message queue memory; note that delete should not be called on the return value
1027 new (slot) LocalType( &manager, &UpdateManager::AddShader, shader );
1030 // The render thread can safely change the Shader
1031 inline void RemoveShaderMessage( UpdateManager& manager, const Shader* shader )
1033 typedef MessageValue1< UpdateManager, Shader* > LocalType;
1035 // Reserve some memory inside the message queue
1036 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1038 // Construct message in the message queue memory; note that delete should not be called on the return value
1039 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, const_cast<Shader*>( shader ) );
1042 inline void SetShaderProgramMessage( UpdateManager& manager,
1043 const Shader& shader,
1044 Internal::ShaderDataPtr shaderData,
1045 bool modifiesGeometry )
1047 typedef MessageValue3< UpdateManager, Shader*, Internal::ShaderDataPtr, bool > LocalType;
1049 // Reserve some memory inside the message queue
1050 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1052 // Construct message in the message queue memory; note that delete should not be called on the return value
1053 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, const_cast<Shader*>( &shader ), shaderData, modifiesGeometry );
1056 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int32_t>& rect )
1058 typedef MessageValue1< UpdateManager, Rect<int32_t> > LocalType;
1060 // Reserve some memory inside the message queue
1061 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1063 // Construct message in the message queue memory; note that delete should not be called on the return value
1064 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
1067 inline void SurfaceReplacedMessage( UpdateManager& manager, const SceneGraph::Scene& constScene )
1069 // The scene-graph thread owns this object so it can safely edit it.
1070 Scene& scene = const_cast< Scene& >( constScene );
1072 typedef MessageValue1< UpdateManager, Scene* > LocalType;
1074 // Reserve some memory inside the message queue
1075 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1077 // Construct message in the message queue memory; note that delete should not be called on the return value
1078 new (slot) LocalType( &manager, &UpdateManager::SurfaceReplaced, &scene );
1081 inline void SetDefaultSurfaceOrientationMessage( UpdateManager& manager, int orientation )
1083 typedef MessageValue1< UpdateManager, int > LocalType;
1085 // Reserve some memory inside the message queue
1086 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1088 // Construct message in the message queue memory; note that delete should not be called on the return value
1089 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceOrientation, orientation );
1092 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
1094 typedef MessageValue1< UpdateManager, float > LocalType;
1096 // Reserve some memory inside the message queue
1097 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1099 // Construct message in the message queue memory; note that delete should not be called on the return value
1100 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
1103 inline void SetRenderingBehaviorMessage( UpdateManager& manager, DevelStage::Rendering renderingBehavior )
1105 typedef MessageValue1< UpdateManager, DevelStage::Rendering > LocalType;
1107 // Reserve some memory inside the message queue
1108 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1110 // Construct message in the message queue memory; note that delete should not be called on the return value
1111 new (slot) LocalType( &manager, &UpdateManager::SetRenderingBehavior, renderingBehavior );
1115 * Create a message for setting the depth of a layer
1116 * @param[in] manager The update manager
1117 * @param[in] layers list of layers
1118 * @param[in] rootLayer The rool layer
1120 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, const Layer* rootLayer )
1122 typedef MessageValue2< UpdateManager, std::vector< Layer* >, const Layer* > LocalType;
1124 // Reserve some memory inside the message queue
1125 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1127 // Construct message in the message queue memory; note that delete should not be called on the return value
1128 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, rootLayer );
1131 inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >& object )
1133 typedef MessageValue1< UpdateManager, OwnerPointer< Renderer > > LocalType;
1135 // Reserve some memory inside the message queue
1136 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1137 // Construct message in the message queue memory; note that delete should not be called on the return value
1138 new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object );
1141 inline void RemoveRendererMessage( UpdateManager& manager, const Renderer& object )
1143 typedef MessageValue1< UpdateManager, Renderer* > LocalType;
1145 // Reserve some memory inside the message queue
1146 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1147 // Construct message in the message queue memory; note that delete should not be called on the return value
1148 new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, const_cast<Renderer*>( &object ) );
1151 // The render thread can safely change the Shader
1152 inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureSet >& textureSet )
1154 typedef MessageValue1< UpdateManager, OwnerPointer< TextureSet > > LocalType;
1156 // Reserve some memory inside the message queue
1157 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1159 // Construct message in the message queue memory; note that delete should not be called on the return value
1160 new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, textureSet );
1163 // The render thread can safely change the Shader
1164 inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& textureSet )
1166 typedef MessageValue1< UpdateManager, TextureSet* > LocalType;
1168 // Reserve some memory inside the message queue
1169 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1171 // Construct message in the message queue memory; note that delete should not be called on the return value
1172 new (slot) LocalType( &manager, &UpdateManager::RemoveTextureSet, &textureSet );
1175 inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sampler >& sampler )
1177 // Message has ownership of Sampler while in transit from event -> update
1178 typedef MessageValue1< UpdateManager, OwnerPointer< Render::Sampler > > LocalType;
1180 // Reserve some memory inside the message queue
1181 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1183 // Construct message in the message queue memory; note that delete should not be called on the return value
1184 new (slot) LocalType( &manager, &UpdateManager::AddSampler, sampler );
1187 inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
1189 typedef MessageValue1< UpdateManager, Render::Sampler* > LocalType;
1191 // Reserve some memory inside the message queue
1192 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1194 // Construct message in the message queue memory; note that delete should not be called on the return value
1195 new (slot) LocalType( &manager, &UpdateManager::RemoveSampler, &sampler );
1198 inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode )
1200 typedef MessageValue3< UpdateManager, Render::Sampler*, uint32_t, uint32_t > LocalType;
1202 // Reserve some memory inside the message queue
1203 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1205 // Construct message in the message queue memory; note that delete should not be called on the return value
1206 new (slot) LocalType( &manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode );
1209 inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode )
1211 typedef MessageValue4< UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t > LocalType;
1213 // Reserve some memory inside the message queue
1214 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1216 // Construct message in the message queue memory; note that delete should not be called on the return value
1217 new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode );
1220 inline void AddPropertyBuffer( UpdateManager& manager, OwnerPointer< Render::PropertyBuffer >& propertyBuffer )
1222 // Message has ownership of propertyBuffer while in transit from event -> update
1223 typedef MessageValue1< UpdateManager, OwnerPointer< Render::PropertyBuffer > > LocalType;
1225 // Reserve some memory inside the message queue
1226 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1228 // Construct message in the message queue memory; note that delete should not be called on the return value
1229 new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, propertyBuffer );
1232 inline void RemovePropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer )
1234 typedef MessageValue1< UpdateManager, Render::PropertyBuffer* > LocalType;
1236 // Reserve some memory inside the message queue
1237 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1239 // Construct message in the message queue memory; note that delete should not be called on the return value
1240 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyBuffer, &propertyBuffer );
1243 inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format )
1245 // Message has ownership of PropertyBuffer::Format while in transit from event -> update
1246 typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format> > LocalType;
1248 // Reserve some memory inside the message queue
1249 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1251 // Construct message in the message queue memory; note that delete should not be called on the return value
1252 new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferFormat, &propertyBuffer, format );
1255 inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size )
1257 // Message has ownership of PropertyBuffer data while in transit from event -> update
1258 typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector<uint8_t> >, uint32_t > LocalType;
1260 // Reserve some memory inside the message queue
1261 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1263 // Construct message in the message queue memory; note that delete should not be called on the return value
1264 new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data, size );
1267 inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry >& geometry )
1269 // Message has ownership of Geometry while in transit from event -> update
1270 typedef MessageValue1< UpdateManager, OwnerPointer< Render::Geometry > > LocalType;
1272 // Reserve some memory inside the message queue
1273 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
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::AddGeometry, geometry );
1279 inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry )
1281 typedef MessageValue1< UpdateManager, Render::Geometry* > LocalType;
1283 // Reserve some memory inside the message queue
1284 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1286 // Construct message in the message queue memory; note that delete should not be called on the return value
1287 new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry );
1290 inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
1292 typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
1294 // Reserve some memory inside the message queue
1295 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1297 // Construct message in the message queue memory; note that delete should not be called on the return value
1298 new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
1301 inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
1303 typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
1305 // Reserve some memory inside the message queue
1306 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1308 // Construct message in the message queue memory; note that delete should not be called on the return value
1309 new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
1312 // Custom message type for SetIndexBuffer() used to move data with Vector::Swap()
1313 template< typename T >
1314 class IndexBufferMessage : public MessageBase
1319 * Constructor which does a Vector::Swap()
1321 IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector<uint16_t>& indices )
1323 mManager( manager ),
1324 mRenderGeometry( geometry )
1326 mIndices.Swap( indices );
1330 * Virtual destructor
1332 virtual ~IndexBufferMessage()
1337 * @copydoc MessageBase::Process
1339 virtual void Process( BufferIndex /*bufferIndex*/ )
1341 DALI_ASSERT_DEBUG( mManager && "Message does not have an object" );
1342 mManager->SetIndexBuffer( mRenderGeometry, mIndices );
1348 Render::Geometry* mRenderGeometry;
1349 Dali::Vector<uint16_t> mIndices;
1352 inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<uint16_t>& indices )
1354 typedef IndexBufferMessage< UpdateManager > LocalType;
1356 // Reserve some memory inside the message queue
1357 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1359 // Construct message in the message queue memory; note that delete should not be called on the return value
1360 new (slot) LocalType( &manager, &geometry, indices );
1363 inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType )
1365 typedef MessageValue2< UpdateManager, Render::Geometry*, uint32_t > LocalType;
1367 // Reserve some memory inside the message queue
1368 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1370 // Construct message in the message queue memory; note that delete should not be called on the return value
1371 new (slot) LocalType( &manager, &UpdateManager::SetGeometryType, &geometry, geometryType );
1374 inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& texture )
1376 // Message has ownership of Texture while in transit from event -> update
1377 typedef MessageValue1< UpdateManager, OwnerPointer< Render::Texture > > LocalType;
1379 // Reserve some memory inside the message queue
1380 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1382 // Construct message in the message queue memory; note that delete should not be called on the return value
1383 new (slot) LocalType( &manager, &UpdateManager::AddTexture, texture );
1386 inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture )
1388 typedef MessageValue1< UpdateManager, Render::Texture* > LocalType;
1390 // Reserve some memory inside the message queue
1391 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1393 // Construct message in the message queue memory; note that delete should not be called on the return value
1394 new (slot) LocalType( &manager, &UpdateManager::RemoveTexture, &texture );
1397 inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& texture, PixelDataPtr pixelData, const Texture::UploadParams& params )
1399 typedef MessageValue3< UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams > LocalType;
1401 // Reserve some memory inside the message queue
1402 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1404 // Construct message in the message queue memory; note that delete should not be called on the return value
1405 new (slot) LocalType( &manager, &UpdateManager::UploadTexture, &texture, pixelData, params );
1408 inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& texture )
1410 typedef MessageValue1< UpdateManager, Render::Texture* > LocalType;
1412 // Reserve some memory inside the message queue
1413 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1415 // Construct message in the message queue memory; note that delete should not be called on the return value
1416 new (slot) LocalType( &manager, &UpdateManager::GenerateMipmaps, &texture );
1420 inline void AddFrameBuffer( UpdateManager& manager, OwnerPointer< Render::FrameBuffer >& frameBuffer )
1422 typedef MessageValue1< UpdateManager, OwnerPointer< Render::FrameBuffer > > LocalType;
1424 // Reserve some memory inside the message queue
1425 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1427 // Construct message in the message queue memory; note that delete should not be called on the return value
1428 new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, frameBuffer );
1431 inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
1433 typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType;
1435 // Reserve some memory inside the message queue
1436 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1438 // Construct message in the message queue memory; note that delete should not be called on the return value
1439 new (slot) LocalType( &manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer );
1442 inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer )
1444 typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t > LocalType;
1446 // Reserve some memory inside the message queue
1447 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1449 // Construct message in the message queue memory; note that delete should not be called on the return value
1450 new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
1453 inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDepths >& nodeDepths )
1455 typedef MessageValue1< UpdateManager, OwnerPointer< NodeDepths > > LocalType;
1457 // Reserve some memory inside the message queue
1458 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1460 // Construct message in the message queue memory; note that delete should not be called on the return value
1461 new (slot) LocalType( &manager, &UpdateManager::SetDepthIndices, nodeDepths );
1464 inline void AddResetterMessage( UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter )
1466 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyResetterBase> > LocalType;
1468 // Reserve some memory inside the message queue
1469 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1471 // Construct message in the message queue memory; note that delete should not be called on the return value
1472 new (slot) LocalType( &manager, &UpdateManager::AddPropertyResetter, resetter );
1475 inline void AddFrameCallbackMessage( UpdateManager& manager, OwnerPointer< FrameCallback >& frameCallback, const Node& rootNode )
1477 typedef MessageValue2< UpdateManager, OwnerPointer< FrameCallback >, const Node* > LocalType;
1479 // Reserve some memory inside the message queue
1480 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1482 // Construct message in the message queue memory; note that delete should not be called on the return value
1483 new (slot) LocalType( &manager, &UpdateManager::AddFrameCallback, frameCallback, &rootNode );
1486 inline void RemoveFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback )
1488 typedef MessageValue1< UpdateManager, FrameCallbackInterface* > LocalType;
1490 // Reserve some memory inside the message queue
1491 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1493 // Construct message in the message queue memory; note that delete should not be called on the return value
1494 new (slot) LocalType( &manager, &UpdateManager::RemoveFrameCallback, &frameCallback );
1497 } // namespace SceneGraph
1499 } // namespace Internal
1503 #endif // DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H