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-vertex-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 ~UpdateManager() override;
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 void SaveBinary( Internal::ShaderDataPtr shaderData ) override;
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 AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& propertryBuffer );
476 * Removes an existing VertexBuffer 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 RemoveVertexBuffer( Render::VertexBuffer* propertryBuffer );
483 * Sets the format of an existing property buffer
484 * @param[in] vertexBuffer 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 SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format );
491 * Sets the data of an existing property buffer
492 * @param[in] vertexBuffer 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 SetVertexBufferData( Render::VertexBuffer* vertexBuffer, 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] vertexBuffer The property buffer
533 void AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer );
536 * Removes a vertex buffer from a geometry
537 * @param[in] geometry The geometry
538 * @param[in] vertexBuffer The property buffer
540 void RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer );
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 * Attach a texture as depth output to an existing FrameBuffer
595 * @param[in] frameBuffer The FrameBuffer
596 * @param[in] texture The texture that will be used as output when rendering
597 * @param[in] mipmapLevel The mipmap of the texture to be attached
599 void AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
602 * Attach a texture as depth/stencil output to an existing FrameBuffer
603 * @param[in] frameBuffer The FrameBuffer
604 * @param[in] texture The texture that will be used as output when rendering
605 * @param[in] mipmapLevel The mipmap of the texture to be attached
607 void AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
610 * This is called when the surface of the scene has been replaced.
611 * @param[in] scene The scene.
613 void SurfaceReplaced( Scene* scene );
618 * Performs an Update traversal on the scene-graph.
619 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
620 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
621 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
622 * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
623 * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
624 * @return True if further updates are required e.g. during animations.
626 uint32_t Update( float elapsedSeconds,
627 uint32_t lastVSyncTimeMilliseconds,
628 uint32_t nextVSyncTimeMilliseconds,
629 bool renderToFboEnabled,
630 bool isRenderingToFbo );
633 * Set the default surface rect.
634 * @param[in] rect The rect value representing the surface.
636 void SetDefaultSurfaceRect( const Rect<int>& rect );
639 * @copydoc Dali::Stage::KeepRendering()
641 void KeepRendering( float durationSeconds );
644 * @copydoc Dali::DevelStage::SetRenderingBehavior()
646 void SetRenderingBehavior( DevelStage::Rendering renderingBehavior );
649 * Request to render the current frame
650 * @note This is a temporary workaround (to be removed in the future) to request the rendering of
651 * the current frame if the color or visibility of any actor is updated. It MUST NOT be used
652 * for any other purposes.
654 void RequestRendering();
657 * Sets the depths of all layers.
658 * @param layers The layers in depth order.
659 * @param[in] rootLayer The root layer of the sorted layers.
661 void SetLayerDepths( const std::vector< Layer* >& layers, const Layer* rootLayer );
664 * Set the depth indices of all nodes (in LayerUI's)
665 * @param[in] nodeDepths A vector of nodes and associated depth indices
667 void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths );
670 * Query wheter the default surface rect is changed or not.
671 * @return true if the default surface rect is changed.
673 bool IsDefaultSurfaceRectChanged();
676 * Adds an implementation of the FrameCallbackInterface.
677 * @param[in] frameCallback An OwnerPointer to the SceneGraph FrameCallback object
678 * @param[in] rootNode A pointer to the root node to apply the FrameCallback to
680 void AddFrameCallback( OwnerPointer< FrameCallback >& frameCallback, const Node* rootNode );
683 * Removes the specified implementation of FrameCallbackInterface.
684 * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to remove.
686 void RemoveFrameCallback( FrameCallbackInterface* frameCallback );
691 UpdateManager(const UpdateManager&);
694 UpdateManager& operator=(const UpdateManager& rhs);
697 * Helper to check whether the update-thread should keep going.
698 * @param[in] elapsedSeconds The time in seconds since the previous update.
699 * @return True if the update-thread should keep going.
701 uint32_t KeepUpdatingCheck( float elapsedSeconds ) const;
704 * Helper to reset all Node properties
705 * @param[in] bufferIndex to use
707 void ResetProperties( BufferIndex bufferIndex );
710 * Perform gesture updates.
711 * @param[in] bufferIndex to use
712 * @param[in] lastVSyncTime The last VSync time in milliseconds.
713 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
714 * @return true, if any properties were updated.
716 bool ProcessGestures( BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds );
719 * Perform animation updates
720 * @param[in] bufferIndex to use
721 * @param[in] elapsedSeconds time since last frame
722 * @return true if at least one animations is currently active or false otherwise
724 bool Animate( BufferIndex bufferIndex, float elapsedSeconds );
727 * Applies constraints to CustomObjects
728 * @param[in] bufferIndex to use
730 void ConstrainCustomObjects( BufferIndex bufferIndex );
733 * Applies constraints to RenderTasks
734 * @param[in] bufferIndex to use
736 void ConstrainRenderTasks( BufferIndex bufferIndex );
739 * Applies constraints to Shaders
740 * @param[in] bufferIndex to use
742 void ConstrainShaders( BufferIndex bufferIndex );
745 * Perform property notification updates
746 * @param[in] bufferIndex to use
748 void ProcessPropertyNotifications( BufferIndex bufferIndex );
751 * Pass shader binaries queued here on to event thread.
753 void ForwardCompiledShadersToEventThread();
756 * Update node shaders, opacity, geometry etc.
757 * @param[in] bufferIndex to use
759 void UpdateNodes( BufferIndex bufferIndex );
763 * @param[in] bufferIndex to use
765 void UpdateRenderers( BufferIndex bufferIndex );
769 // needs to be direct member so that getter for event buffer can be inlined
770 SceneGraphBuffers mSceneGraphBuffers;
777 // Messages for UpdateManager
779 inline void InstallRootMessage( UpdateManager& manager, OwnerPointer<Layer>& root )
781 // Message has ownership of Layer while in transit from event -> update
782 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Layer> >;
784 // Reserve some memory inside the message queue
785 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
787 // Construct message in the message queue memory; note that delete should not be called on the return value
788 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root );
791 inline void UninstallRootMessage( UpdateManager& manager, const Layer* constRoot )
793 // Scene graph thread can destroy this object.
794 Layer* root = const_cast< Layer* >( constRoot );
796 using LocalType = MessageValue1<UpdateManager, Layer*>;
798 // Reserve some memory inside the message queue
799 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
801 // Construct message in the message queue memory; note that delete should not be called on the return value
802 new (slot) LocalType( &manager, &UpdateManager::UninstallRoot, root );
805 inline void AddNodeMessage( UpdateManager& manager, OwnerPointer<Node>& node )
807 // Message has ownership of Node while in transit from event -> update
808 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Node> >;
810 // Reserve some memory inside the message queue
811 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
813 // Construct message in the message queue memory; note that delete should not be called on the return value
814 new (slot) LocalType( &manager, &UpdateManager::AddNode, node );
817 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
819 // Update thread can edit the object
820 Node& parent = const_cast< Node& >( constParent );
821 Node& child = const_cast< Node& >( constChild );
823 using LocalType = MessageValue2<UpdateManager, Node*, Node*>;
825 // Reserve some memory inside the message queue
826 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
828 // Construct message in the message queue memory; note that delete should not be called on the return value
829 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
832 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
834 // Scene graph thread can modify this object.
835 Node& node = const_cast< Node& >( constNode );
837 using LocalType = MessageValue1<UpdateManager, Node*>;
839 // Reserve some memory inside the message queue
840 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
842 // Construct message in the message queue memory; note that delete should not be called on the return value
843 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
846 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
848 // Scene graph thread can destroy this object.
849 Node& node = const_cast< Node& >( constNode );
851 using LocalType = MessageValue1<UpdateManager, Node*>;
853 // Reserve some memory inside the message queue
854 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
856 // Construct message in the message queue memory; note that delete should not be called on the return value
857 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
860 inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& camera )
862 // Message has ownership of Camera while in transit from event -> update
863 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Camera> >;
865 // Reserve some memory inside the message queue
866 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
868 // Construct message in the message queue memory; note that delete should not be called on the return value
869 new (slot) LocalType( &manager, &UpdateManager::AddCamera, camera );
872 inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera )
874 using LocalType = MessageValue1<UpdateManager, Camera*>;
876 // Reserve some memory inside the message queue
877 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
879 // Construct message in the message queue memory; note that delete should not be called on the return value
880 new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, const_cast<Camera*>( camera ) );
883 inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner>& object )
885 // Message has ownership of object while in transit from event -> update
886 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyOwner> >;
888 // Reserve some memory inside the message queue
889 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
891 // Construct message in the message queue memory; note that delete should not be called on the return value
892 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
895 inline void RemoveObjectMessage( UpdateManager& manager, const PropertyOwner* object )
897 using LocalType = MessageValue1<UpdateManager, PropertyOwner*>;
899 // Reserve some memory inside the message queue
900 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
902 // Construct message in the message queue memory; note that delete should not be called on the return value
903 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, const_cast<PropertyOwner*>( object ) );
906 inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation )
908 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Animation> >;
910 // Reserve some memory inside the message queue
911 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
913 // Construct message in the message queue memory; note that delete should not be called on the return value
914 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
917 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
919 // The scene-graph thread owns this object so it can safely edit it.
920 Animation& animation = const_cast< Animation& >( constAnimation );
922 using LocalType = MessageValue1<UpdateManager, Animation*>;
924 // Reserve some memory inside the message queue
925 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
927 // Construct message in the message queue memory; note that delete should not be called on the return value
928 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
931 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
933 // The scene-graph thread owns this object so it can safely edit it.
934 Animation& animation = const_cast< Animation& >( constAnimation );
936 using LocalType = MessageValue1<UpdateManager, Animation*>;
938 // Reserve some memory inside the message queue
939 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
941 // Construct message in the message queue memory; note that delete should not be called on the return value
942 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
945 inline void AddRenderTaskListMessage( UpdateManager& manager, OwnerPointer< SceneGraph::RenderTaskList >& taskList )
947 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::RenderTaskList> >;
949 // Reserve some memory inside the message queue
950 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
952 // Construct message in the message queue memory; note that delete should not be called on the return value
953 new (slot) LocalType( &manager, &UpdateManager::AddRenderTaskList, taskList );
956 inline void RemoveRenderTaskListMessage( UpdateManager& manager, const RenderTaskList& constTaskList )
958 // The scene-graph thread owns this object so it can safely edit it.
959 RenderTaskList& taskList = const_cast< RenderTaskList& >( constTaskList );
961 using LocalType = MessageValue1<UpdateManager, RenderTaskList*>;
963 // Reserve some memory inside the message queue
964 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
966 // Construct message in the message queue memory; note that delete should not be called on the return value
967 new (slot) LocalType( &manager, &UpdateManager::RemoveRenderTaskList, &taskList );
970 inline void AddSceneMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Scene >& scene )
972 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Scene> >;
974 // Reserve some memory inside the message queue
975 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
977 // Construct message in the message queue memory; note that delete should not be called on the return value
978 new (slot) LocalType( &manager, &UpdateManager::AddScene, scene );
981 inline void RemoveSceneMessage( UpdateManager& manager, const SceneGraph::Scene& constScene )
983 // The scene-graph thread owns this object so it can safely edit it.
984 Scene& scene = const_cast< Scene& >( constScene );
986 using LocalType = MessageValue1<UpdateManager, Scene*>;
988 // Reserve some memory inside the message queue
989 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
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::RemoveScene, &scene );
995 inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification )
997 // Message has ownership of PropertyNotification while in transit from event -> update
998 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyNotification> >;
1000 // Reserve some memory inside the message queue
1001 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
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::AddPropertyNotification, propertyNotification );
1007 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
1009 // The scene-graph thread owns this object so it can safely edit it.
1010 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
1012 using LocalType = MessageValue1<UpdateManager, PropertyNotification*>;
1014 // Reserve some memory inside the message queue
1015 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1017 // Construct message in the message queue memory; note that delete should not be called on the return value
1018 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
1021 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
1022 const PropertyNotification* constPropertyNotification,
1023 PropertyNotification::NotifyMode notifyMode )
1025 // The scene-graph thread owns this object so it can safely edit it.
1026 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
1028 using LocalType = MessageValue2<UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode>;
1030 // Reserve some memory inside the message queue
1031 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1033 // Construct message in the message queue memory; note that delete should not be called on the return value
1034 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
1037 // The render thread can safely change the Shader
1038 inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& shader )
1040 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Shader> >;
1042 // Reserve some memory inside the message queue
1043 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1045 // Construct message in the message queue memory; note that delete should not be called on the return value
1046 new (slot) LocalType( &manager, &UpdateManager::AddShader, shader );
1049 // The render thread can safely change the Shader
1050 inline void RemoveShaderMessage( UpdateManager& manager, const Shader* shader )
1052 using LocalType = MessageValue1<UpdateManager, Shader*>;
1054 // Reserve some memory inside the message queue
1055 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1057 // Construct message in the message queue memory; note that delete should not be called on the return value
1058 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, const_cast<Shader*>( shader ) );
1061 inline void SetShaderProgramMessage( UpdateManager& manager,
1062 const Shader& shader,
1063 Internal::ShaderDataPtr shaderData,
1064 bool modifiesGeometry )
1066 using LocalType = MessageValue3<UpdateManager, Shader*, Internal::ShaderDataPtr, bool>;
1068 // Reserve some memory inside the message queue
1069 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1071 // Construct message in the message queue memory; note that delete should not be called on the return value
1072 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, const_cast<Shader*>( &shader ), shaderData, modifiesGeometry );
1075 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int32_t>& rect )
1077 using LocalType = MessageValue1<UpdateManager, Rect<int32_t> >;
1079 // Reserve some memory inside the message queue
1080 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1082 // Construct message in the message queue memory; note that delete should not be called on the return value
1083 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
1086 inline void SurfaceReplacedMessage( UpdateManager& manager, const SceneGraph::Scene& constScene )
1088 // The scene-graph thread owns this object so it can safely edit it.
1089 Scene& scene = const_cast< Scene& >( constScene );
1091 using LocalType = MessageValue1<UpdateManager, Scene*>;
1093 // Reserve some memory inside the message queue
1094 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1096 // Construct message in the message queue memory; note that delete should not be called on the return value
1097 new (slot) LocalType( &manager, &UpdateManager::SurfaceReplaced, &scene );
1100 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
1102 using LocalType = MessageValue1<UpdateManager, float>;
1104 // Reserve some memory inside the message queue
1105 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1107 // Construct message in the message queue memory; note that delete should not be called on the return value
1108 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
1111 inline void SetRenderingBehaviorMessage( UpdateManager& manager, DevelStage::Rendering renderingBehavior )
1113 using LocalType = MessageValue1<UpdateManager, DevelStage::Rendering>;
1115 // Reserve some memory inside the message queue
1116 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1118 // Construct message in the message queue memory; note that delete should not be called on the return value
1119 new (slot) LocalType( &manager, &UpdateManager::SetRenderingBehavior, renderingBehavior );
1122 inline void RequestRenderingMessage( UpdateManager& manager )
1124 using LocalType = Message<UpdateManager>;
1126 // Reserve some memory inside the message queue
1127 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1129 // Construct message in the message queue memory; note that delete should not be called on the return value
1130 new (slot) LocalType( &manager, &UpdateManager::RequestRendering );
1134 * Create a message for setting the depth of a layer
1135 * @param[in] manager The update manager
1136 * @param[in] layers list of layers
1137 * @param[in] rootLayer The rool layer
1139 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, const Layer* rootLayer )
1141 using LocalType = MessageValue2<UpdateManager, std::vector<Layer*>, const Layer*>;
1143 // Reserve some memory inside the message queue
1144 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1146 // Construct message in the message queue memory; note that delete should not be called on the return value
1147 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, rootLayer );
1150 inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >& object )
1152 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Renderer> >;
1154 // Reserve some memory inside the message queue
1155 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1156 // Construct message in the message queue memory; note that delete should not be called on the return value
1157 new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object );
1160 inline void RemoveRendererMessage( UpdateManager& manager, const Renderer& object )
1162 using LocalType = MessageValue1<UpdateManager, Renderer*>;
1164 // Reserve some memory inside the message queue
1165 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1166 // Construct message in the message queue memory; note that delete should not be called on the return value
1167 new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, const_cast<Renderer*>( &object ) );
1170 // The render thread can safely change the Shader
1171 inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureSet >& textureSet )
1173 using LocalType = MessageValue1<UpdateManager, OwnerPointer<TextureSet> >;
1175 // Reserve some memory inside the message queue
1176 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1178 // Construct message in the message queue memory; note that delete should not be called on the return value
1179 new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, textureSet );
1182 // The render thread can safely change the Shader
1183 inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& textureSet )
1185 using LocalType = MessageValue1<UpdateManager, TextureSet*>;
1187 // Reserve some memory inside the message queue
1188 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1190 // Construct message in the message queue memory; note that delete should not be called on the return value
1191 new (slot) LocalType( &manager, &UpdateManager::RemoveTextureSet, &textureSet );
1194 inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sampler >& sampler )
1196 // Message has ownership of Sampler while in transit from event -> update
1197 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Sampler> >;
1199 // Reserve some memory inside the message queue
1200 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1202 // Construct message in the message queue memory; note that delete should not be called on the return value
1203 new (slot) LocalType( &manager, &UpdateManager::AddSampler, sampler );
1206 inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
1208 using LocalType = MessageValue1<UpdateManager, Render::Sampler*>;
1210 // Reserve some memory inside the message queue
1211 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1213 // Construct message in the message queue memory; note that delete should not be called on the return value
1214 new (slot) LocalType( &manager, &UpdateManager::RemoveSampler, &sampler );
1217 inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode )
1219 using LocalType = MessageValue3<UpdateManager, Render::Sampler*, uint32_t, uint32_t>;
1221 // Reserve some memory inside the message queue
1222 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1224 // Construct message in the message queue memory; note that delete should not be called on the return value
1225 new (slot) LocalType( &manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode );
1228 inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode )
1230 using LocalType = MessageValue4<UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t>;
1232 // Reserve some memory inside the message queue
1233 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1235 // Construct message in the message queue memory; note that delete should not be called on the return value
1236 new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode );
1239 inline void AddVertexBuffer( UpdateManager& manager, OwnerPointer< Render::VertexBuffer >& vertexBuffer )
1241 // Message has ownership of vertexBuffer while in transit from event -> update
1242 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::VertexBuffer> >;
1244 // Reserve some memory inside the message queue
1245 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1247 // Construct message in the message queue memory; note that delete should not be called on the return value
1248 new (slot) LocalType( &manager, &UpdateManager::AddVertexBuffer, vertexBuffer );
1251 inline void RemoveVertexBuffer( UpdateManager& manager, Render::VertexBuffer& vertexBuffer )
1253 using LocalType = MessageValue1<UpdateManager, Render::VertexBuffer*>;
1255 // Reserve some memory inside the message queue
1256 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1258 // Construct message in the message queue memory; note that delete should not be called on the return value
1259 new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &vertexBuffer );
1262 inline void SetVertexBufferFormat( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format )
1264 // Message has ownership of VertexBuffer::Format while in transit from event -> update
1265 using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, OwnerPointer<Render::VertexBuffer::Format> >;
1267 // Reserve some memory inside the message queue
1268 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1270 // Construct message in the message queue memory; note that delete should not be called on the return value
1271 new (slot) LocalType( &manager, &UpdateManager::SetVertexBufferFormat, &vertexBuffer, format );
1274 inline void SetVertexBufferData( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size )
1276 // Message has ownership of VertexBuffer data while in transit from event -> update
1277 using LocalType = MessageValue3<UpdateManager, Render::VertexBuffer*, OwnerPointer<Vector<uint8_t> >, uint32_t>;
1279 // Reserve some memory inside the message queue
1280 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1282 // Construct message in the message queue memory; note that delete should not be called on the return value
1283 new (slot) LocalType( &manager, &UpdateManager::SetVertexBufferData, &vertexBuffer, data, size );
1286 inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry >& geometry )
1288 // Message has ownership of Geometry while in transit from event -> update
1289 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Geometry> >;
1291 // Reserve some memory inside the message queue
1292 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1294 // Construct message in the message queue memory; note that delete should not be called on the return value
1295 new (slot) LocalType( &manager, &UpdateManager::AddGeometry, geometry );
1298 inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry )
1300 using LocalType = MessageValue1<UpdateManager, Render::Geometry*>;
1302 // Reserve some memory inside the message queue
1303 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1305 // Construct message in the message queue memory; note that delete should not be called on the return value
1306 new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry );
1309 inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer )
1311 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
1313 // Reserve some memory inside the message queue
1314 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1316 // Construct message in the message queue memory; note that delete should not be called on the return value
1317 new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer) );
1320 inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer )
1322 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
1324 // Reserve some memory inside the message queue
1325 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1327 // Construct message in the message queue memory; note that delete should not be called on the return value
1328 new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer) );
1331 // Custom message type for SetIndexBuffer() used to move data with Vector::Swap()
1332 template< typename T >
1333 class IndexBufferMessage : public MessageBase
1338 * Constructor which does a Vector::Swap()
1340 IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector<uint16_t>& indices )
1342 mManager( manager ),
1343 mRenderGeometry( geometry )
1345 mIndices.Swap( indices );
1349 * Virtual destructor
1351 ~IndexBufferMessage() override
1356 * @copydoc MessageBase::Process
1358 void Process( BufferIndex /*bufferIndex*/ ) override
1360 DALI_ASSERT_DEBUG( mManager && "Message does not have an object" );
1361 mManager->SetIndexBuffer( mRenderGeometry, mIndices );
1367 Render::Geometry* mRenderGeometry;
1368 Dali::Vector<uint16_t> mIndices;
1371 inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<uint16_t>& indices )
1373 using LocalType = IndexBufferMessage<UpdateManager>;
1375 // Reserve some memory inside the message queue
1376 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1378 // Construct message in the message queue memory; note that delete should not be called on the return value
1379 new (slot) LocalType( &manager, &geometry, indices );
1382 inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType )
1384 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, uint32_t>;
1386 // Reserve some memory inside the message queue
1387 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1389 // Construct message in the message queue memory; note that delete should not be called on the return value
1390 new (slot) LocalType( &manager, &UpdateManager::SetGeometryType, &geometry, geometryType );
1393 inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& texture )
1395 // Message has ownership of Texture while in transit from event -> update
1396 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Texture> >;
1398 // Reserve some memory inside the message queue
1399 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1401 // Construct message in the message queue memory; note that delete should not be called on the return value
1402 new (slot) LocalType( &manager, &UpdateManager::AddTexture, texture );
1405 inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture )
1407 using LocalType = MessageValue1<UpdateManager, Render::Texture*>;
1409 // Reserve some memory inside the message queue
1410 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1412 // Construct message in the message queue memory; note that delete should not be called on the return value
1413 new (slot) LocalType( &manager, &UpdateManager::RemoveTexture, &texture );
1416 inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& texture, PixelDataPtr pixelData, const Texture::UploadParams& params )
1418 using LocalType = MessageValue3<UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams>;
1420 // Reserve some memory inside the message queue
1421 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1423 // Construct message in the message queue memory; note that delete should not be called on the return value
1424 new (slot) LocalType( &manager, &UpdateManager::UploadTexture, &texture, pixelData, params );
1427 inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& texture )
1429 using LocalType = MessageValue1<UpdateManager, Render::Texture*>;
1431 // Reserve some memory inside the message queue
1432 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1434 // Construct message in the message queue memory; note that delete should not be called on the return value
1435 new (slot) LocalType( &manager, &UpdateManager::GenerateMipmaps, &texture );
1439 inline void AddFrameBuffer( UpdateManager& manager, OwnerPointer< Render::FrameBuffer >& frameBuffer )
1441 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::FrameBuffer> >;
1443 // Reserve some memory inside the message queue
1444 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1446 // Construct message in the message queue memory; note that delete should not be called on the return value
1447 new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, frameBuffer );
1450 inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
1452 using LocalType = MessageValue1<UpdateManager, Render::FrameBuffer*>;
1454 // Reserve some memory inside the message queue
1455 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1457 // Construct message in the message queue memory; note that delete should not be called on the return value
1458 new (slot) LocalType( &manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer );
1461 inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer )
1463 using LocalType = MessageValue4<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t>;
1465 // Reserve some memory inside the message queue
1466 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1468 // Construct message in the message queue memory; note that delete should not be called on the return value
1469 new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
1472 inline void AttachDepthTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
1474 using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
1476 // Reserve some memory inside the message queue
1477 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1479 // Construct message in the message queue memory; note that delete should not be called on the return value
1480 new (slot) LocalType( &manager, &UpdateManager::AttachDepthTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel );
1483 inline void AttachDepthStencilTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
1485 using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
1487 // Reserve some memory inside the message queue
1488 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1490 // Construct message in the message queue memory; note that delete should not be called on the return value
1491 new (slot) LocalType( &manager, &UpdateManager::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel );
1494 inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDepths >& nodeDepths )
1496 using LocalType = MessageValue1<UpdateManager, OwnerPointer<NodeDepths> >;
1498 // Reserve some memory inside the message queue
1499 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1501 // Construct message in the message queue memory; note that delete should not be called on the return value
1502 new (slot) LocalType( &manager, &UpdateManager::SetDepthIndices, nodeDepths );
1505 inline void AddResetterMessage( UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter )
1507 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyResetterBase> >;
1509 // Reserve some memory inside the message queue
1510 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1512 // Construct message in the message queue memory; note that delete should not be called on the return value
1513 new (slot) LocalType( &manager, &UpdateManager::AddPropertyResetter, resetter );
1516 inline void AddFrameCallbackMessage( UpdateManager& manager, OwnerPointer< FrameCallback >& frameCallback, const Node& rootNode )
1518 using LocalType = MessageValue2<UpdateManager, OwnerPointer<FrameCallback>, const Node*>;
1520 // Reserve some memory inside the message queue
1521 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1523 // Construct message in the message queue memory; note that delete should not be called on the return value
1524 new (slot) LocalType( &manager, &UpdateManager::AddFrameCallback, frameCallback, &rootNode );
1527 inline void RemoveFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback )
1529 using LocalType = MessageValue1<UpdateManager, FrameCallbackInterface*>;
1531 // Reserve some memory inside the message queue
1532 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1534 // Construct message in the message queue memory; note that delete should not be called on the return value
1535 new (slot) LocalType( &manager, &UpdateManager::RemoveFrameCallback, &frameCallback );
1538 } // namespace SceneGraph
1540 } // namespace Internal
1544 #endif // DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H