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)
101 NodeDepths() = default;
103 void Add( SceneGraph::Node* node, uint32_t sortedDepth )
105 nodeDepths.push_back( NodeDepthPair( node, sortedDepth ) );
108 std::vector<NodeDepthPair> nodeDepths;
113 * UpdateManager maintains a scene graph i.e. a tree of nodes as well as
114 * other scene graph property owning objects.
115 * It controls the Update traversal, in which nodes are repositioned/animated,
116 * and organizes the the culling and rendering of the scene.
117 * It also maintains the lifecycle of nodes and other property owners that are
118 * disconnected from the scene graph.
120 class UpdateManager : public ShaderSaver
125 * Construct a new UpdateManager.
126 * @param[in] notificationManager This should be notified when animations have finished.
127 * @param[in] animationPlaylist The CompleteNotificationInterface that handles the animations
128 * @param[in] propertyNotifier The PropertyNotifier
129 * @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
130 * @param[in] controller After messages are flushed, we request a render from the RenderController.
131 * @param[in] renderManager This is responsible for rendering the results of each "update".
132 * @param[in] renderQueue Used to queue messages for the next render.
133 * @param[in] renderTaskProcessor Handles RenderTasks and RenderInstrucitons.
135 UpdateManager( NotificationManager& notificationManager,
136 CompleteNotificationInterface& animationPlaylist,
137 PropertyNotifier& propertyNotifier,
138 DiscardQueue& discardQueue,
139 Integration::RenderController& controller,
140 RenderManager& renderManager,
141 RenderQueue& renderQueue,
142 RenderTaskProcessor& renderTaskProcessor );
147 ~UpdateManager() override;
149 // Node connection methods
152 * Installs a new layer as the root node.
153 * @pre The layer is of derived Node type Layer.
154 * @pre The layer does not have a parent.
155 * @param[in] layer The new root node.
156 * @post The node is owned by UpdateManager.
158 void InstallRoot( OwnerPointer<Layer>& layer );
161 * Uninstalls the root node.
162 * @pre The layer is of derived Node type Layer.
163 * @pre The layer does not have a parent.
164 * @param[in] layer The root node.
165 * @post The node is owned by UpdateManager.
167 void UninstallRoot( Layer* layer );
170 * Add a Node; UpdateManager takes ownership.
171 * @pre The node does not have a parent.
172 * @note even though nodes are pool allocated, they also contain other heap allocated data, thus using OwnerPointer when transferring the data
173 * @param[in] node The node to add.
175 void AddNode( OwnerPointer<Node>& node );
178 * Connect a Node to the scene-graph.
179 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
180 * @pre The node does not already have a parent.
181 * @param[in] parent The new parent node.
183 void ConnectNode( Node* parent, Node* node );
186 * Disconnect a Node from the scene-graph.
187 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
188 * @pre The node has a parent.
189 * @param[in] node The node to disconnect.
191 void DisconnectNode( Node* node );
194 * Destroy a Node owned by UpdateManager.
195 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
196 * In the following update, the previously queued Nodes may be deleted.
197 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
198 * @param[in] node The node to destroy.
200 void DestroyNode( Node* node );
203 * Add a camera on scene
204 * @param[in] camera The camera to add
206 void AddCamera( OwnerPointer< Camera >& camera );
209 * Remove a camera from scene
210 * @param[in] camera to remove
212 void RemoveCamera( Camera* camera );
215 * Add a newly created object.
216 * @param[in] object The object to add.
217 * @post The object is owned by UpdateManager.
219 void AddObject( OwnerPointer<PropertyOwner>& object );
223 * @param[in] object The object to remove.
225 void RemoveObject( PropertyOwner* object );
228 * Add a newly created render task list.
229 * @param[in] taskList The render task list to add.
230 * @post The render task list is owned by UpdateManager.
232 void AddRenderTaskList( OwnerPointer<RenderTaskList>& taskList );
235 * Remove a render task list.
236 * @param[in] taskList The render task list to remove.
238 void RemoveRenderTaskList( RenderTaskList* taskList );
241 * Add a newly created scene.
242 * @param[in] scene The scene to add.
243 * @post The scene is owned by UpdateManager.
245 void AddScene( OwnerPointer<Scene>& scene );
249 * @param[in] scene The scene to remove.
251 void RemoveScene( Scene* scene );
256 * Add a newly created animation.
257 * @param[in] animation The animation to add.
258 * @post The animation is owned by UpdateManager.
260 void AddAnimation( OwnerPointer< SceneGraph::Animation >& animation );
264 * @param[in] animation The animation to stop.
266 void StopAnimation( Animation* animation );
269 * Remove an animation.
270 * @param[in] animation The animation to remove.
272 void RemoveAnimation( Animation* animation );
275 * Query whether any animations are currently running.
276 * @return True if any animations are running.
278 bool IsAnimationRunning() const;
281 * Add a property resetter. UpdateManager takes ownership of the object.
282 * It will be killed by UpdateManager when the associated animator or
283 * constraint has finished; or the property owner of the property is destroyed.
285 void AddPropertyResetter( OwnerPointer<PropertyResetterBase>& propertyResetter );
287 // Property Notification
290 * Add a newly created property notification
291 * @param[in] propertyNotification The notification to add
292 * @post The propertyNotification is owned by UpdateManager.
294 void AddPropertyNotification( OwnerPointer< PropertyNotification >& propertyNotification );
297 * Remove a property notification
298 * @param[in] propertyNotification The notification to remove
300 void RemovePropertyNotification( PropertyNotification* propertyNotification );
303 * Set Notify state for PropertyNotification
304 * @param[in] propertyNotification The notification to remove
305 * @param[in] notifyMode The notification mode.
307 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
312 * Add a newly created shader.
313 * @param[in] shader The shader to add.
314 * @post The shader is owned by the UpdateManager.
316 void AddShader( OwnerPointer< Shader >& shader );
320 * @pre The shader has been added to the UpdateManager.
321 * @param[in] shader The shader to remove.
322 * @post The shader is destroyed.
324 void RemoveShader( Shader* shader );
327 * Set the shader program for a Shader object
328 * @param[in] shader The shader to modify
329 * @param[in] shaderData Source code, hash over source, and optional compiled binary for the shader program
330 * @param[in] modifiesGeometry True if the vertex shader modifies geometry
332 void SetShaderProgram( Shader* shader, Internal::ShaderDataPtr shaderData, bool modifiesGeometry );
335 * @brief Accept compiled shaders passed back on render thread for saving.
336 * @param[in] shaderData Source code, hash over source, and corresponding compiled binary to be saved.
338 void SaveBinary( Internal::ShaderDataPtr shaderData ) override;
341 * @brief Set the destination for compiled shader binaries to be passed on to.
342 * The dispatcher passed in will be called from the update thread.
343 * @param[in] upstream A sink for ShaderDatas to be passed into.
345 void SetShaderSaver( ShaderSaver& upstream );
350 * Add a new renderer to scene
351 * @param renderer to add
353 void AddRenderer( OwnerPointer< Renderer >& renderer );
356 * Add a renderer from scene
357 * @param renderer to remove
359 void RemoveRenderer( Renderer* renderer );
364 * Set the pan gesture processor.
365 * Pan Gesture processor lives for the lifetime of UpdateManager
366 * @param[in] gesture The gesture processor.
367 * @post The gestureProcessor is owned by the UpdateManager.
369 void SetPanGestureProcessor( PanGesture* gestureProcessor );
374 * Add a newly created TextureSet.
375 * @param[in] textureSet The texture set to add.
376 * @post The TextureSet is owned by the UpdateManager.
378 void AddTextureSet( OwnerPointer< TextureSet >& textureSet );
381 * Remove a TextureSet.
382 * @pre The TextureSet has been added to the UpdateManager.
383 * @param[in] textureSet The TextureSet to remove.
384 * @post The TextureSet is destroyed.
386 void RemoveTextureSet( TextureSet* textureSet );
391 * Get the scene graph side list of RenderTasks.
392 * @param[in] systemLevel True if using the system-level overlay.
393 * @return The list of render tasks
395 RenderTaskList* GetRenderTaskList( bool systemLevel );
397 // Message queue handling
400 * Reserve space for another message in the queue; this must then be initialized by the caller.
401 * The message will be read from the update-thread after the next FlushMessages is called.
402 * @post Calling this method may invalidate any previously returned slots.
403 * @param[in] size The message size with respect to the size of type "char".
404 * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
405 * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
406 * @return A pointer to the first char allocated for the message.
408 uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene = true );
411 * @return the current event-buffer index.
413 BufferIndex GetEventBufferIndex() const
415 // inlined as its called often from event thread
416 return mSceneGraphBuffers.GetEventBufferIndex();
420 * Called by the event-thread to signal that FlushQueue will be called
421 * e.g. when it has finished event processing.
423 void EventProcessingStarted();
426 * Flush the set of messages, which were previously stored with QueueMessage().
427 * Calls to this thread-safe method should be minimized, to avoid thread blocking.
429 * @return True if there are messages to process.
434 * Add a new sampler to RenderManager
435 * @param[in] sampler The sampler to add
436 * @post Sends a message to RenderManager to add the sampler.
437 * The sampler will be owned by RenderManager
439 void AddSampler( OwnerPointer< Render::Sampler >& sampler );
442 * Removes an existing sampler from RenderManager
443 * @param[in] sampler The sampler to remove
444 * @post The sampler will be destroyed in the render thread
446 void RemoveSampler( Render::Sampler* sampler );
449 * Sets the filter modes for an existing sampler
450 * @param[in] sampler The sampler
451 * @param[in] minFilterMode The filter to use under minification
452 * @param[in] magFilterMode The filter to use under magnification
454 void SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode );
457 * Sets the wrap mode for an existing sampler
458 * @param[in] sampler The sampler
459 * @param[in] rWrapMode Wrapping mode in z direction
460 * @param[in] sWrapMode Wrapping mode in x direction
461 * @param[in] tWrapMode Wrapping mode in y direction
463 void SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode );
466 * Add a new property buffer to RenderManager
467 * @param[in] propertryBuffer The property buffer to add
468 * @post Sends a message to RenderManager to add the property buffer.
469 * The property buffer will be owned by RenderManager
471 void AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& propertryBuffer );
474 * Removes an existing VertexBuffer from RenderManager
475 * @param[in] propertryBuffer The property buffer to remove
476 * @post The property buffer will be destroyed in the render thread
478 void RemoveVertexBuffer( Render::VertexBuffer* propertryBuffer );
481 * Sets the format of an existing property buffer
482 * @param[in] vertexBuffer The property buffer.
483 * @param[in] format The new format of the buffer
484 * @post Sends a message to RenderManager to set the new format to the property buffer.
486 void SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format );
489 * Sets the data of an existing property buffer
490 * @param[in] vertexBuffer The property buffer.
491 * @param[in] data The new data of the buffer
492 * @param[in] size The new size of the buffer
493 * @post Sends a message to RenderManager to set the new data to the property buffer.
495 void SetVertexBufferData( Render::VertexBuffer* vertexBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size );
498 * Adds a geometry to the RenderManager
499 * @param[in] geometry The geometry to add
500 * @post Sends a message to RenderManager to add the Geometry
501 * The geometry will be owned by RenderManager
503 void AddGeometry( OwnerPointer< Render::Geometry >& geometry );
506 * Removes an existing Geometry from RenderManager
507 * @param[in] geometry The geometry to remove
508 * @post The geometry will be destroyed in the render thread
510 void RemoveGeometry( Render::Geometry* geometry );
513 * Sets the geometry type of an existing Geometry
514 * @param[in] geometry The geometry
515 * @param[in] geometryType The type of the geometry
517 void SetGeometryType( Render::Geometry* geometry, uint32_t geometryType );
520 * Sets the index buffer to be used by a geometry
521 * @param[in] geometry The geometry
522 * @param[in] indices A vector containing the indices for the geometry
524 void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& indices );
527 * Adds a vertex buffer to a geometry
528 * @param[in] geometry The geometry
529 * @param[in] vertexBuffer The property buffer
531 void AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer );
534 * Removes a vertex buffer from a geometry
535 * @param[in] geometry The geometry
536 * @param[in] vertexBuffer The property buffer
538 void RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer );
541 * Adds a texture to the render manager
542 * @param[in] texture The texture to add
543 * The texture will be owned by RenderManager
545 void AddTexture( OwnerPointer< Render::Texture >& texture );
548 * Removes a texture from the render manager
549 * @param[in] texture The texture to remove
550 * @post The texture will be destroyed in the render thread
552 void RemoveTexture( Render::Texture* texture );
555 * Uploads data to a texture owned by the RenderManager
556 * @param[in] texture The texture
557 * @param[in] pixelData The pixel data object
558 * @param[in] params The parameters for the upload
560 void UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params );
563 * Generates mipmaps for a texture owned by the RenderManager
564 * @param[in] texture The texture
566 void GenerateMipmaps( Render::Texture* texture );
569 * Adds a framebuffer to the render manager
570 * @param[in] frameBuffer The framebuffer to add
571 * The framebuffer will be owned by RenderManager
573 void AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer );
576 * Removes a FrameBuffer from the render manager
577 * @param[in] frameBuffer The FrameBuffer to remove
578 * @post The FrameBuffer will be destroyed in the render thread
580 void RemoveFrameBuffer( Render::FrameBuffer* frameBuffer );
583 * Attach a texture as color output to an existing FrameBuffer
584 * @param[in] frameBuffer The FrameBuffer
585 * @param[in] texture The texture that will be used as output when rendering
586 * @param[in] mipmapLevel The mipmap of the texture to be attached
587 * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
589 void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face );
592 * Attach a texture as depth output to an existing FrameBuffer
593 * @param[in] frameBuffer The FrameBuffer
594 * @param[in] texture The texture that will be used as output when rendering
595 * @param[in] mipmapLevel The mipmap of the texture to be attached
597 void AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
600 * Attach a texture as depth/stencil output to an existing FrameBuffer
601 * @param[in] frameBuffer The FrameBuffer
602 * @param[in] texture The texture that will be used as output when rendering
603 * @param[in] mipmapLevel The mipmap of the texture to be attached
605 void AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
608 * This is called when the surface of the scene has been replaced.
609 * @param[in] scene The scene.
611 void SurfaceReplaced( Scene* scene );
616 * Performs an Update traversal on the scene-graph.
617 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
618 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
619 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
620 * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
621 * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
622 * @return True if further updates are required e.g. during animations.
624 uint32_t Update( float elapsedSeconds,
625 uint32_t lastVSyncTimeMilliseconds,
626 uint32_t nextVSyncTimeMilliseconds,
627 bool renderToFboEnabled,
628 bool isRenderingToFbo );
631 * Set the default surface rect.
632 * @param[in] rect The rect value representing the surface.
634 void SetDefaultSurfaceRect( const Rect<int>& rect );
637 * @copydoc Dali::Stage::KeepRendering()
639 void KeepRendering( float durationSeconds );
642 * @copydoc Dali::DevelStage::SetRenderingBehavior()
644 void SetRenderingBehavior( DevelStage::Rendering renderingBehavior );
647 * Request to render the current frame
648 * @note This is a temporary workaround (to be removed in the future) to request the rendering of
649 * the current frame if the color or visibility of any actor is updated. It MUST NOT be used
650 * for any other purposes.
652 void RequestRendering();
655 * Sets the depths of all layers.
656 * @param layers The layers in depth order.
657 * @param[in] rootLayer The root layer of the sorted layers.
659 void SetLayerDepths( const std::vector< Layer* >& layers, const Layer* rootLayer );
662 * Set the depth indices of all nodes (in LayerUI's)
663 * @param[in] nodeDepths A vector of nodes and associated depth indices
665 void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths );
668 * Query wheter the default surface rect is changed or not.
669 * @return true if the default surface rect is changed.
671 bool IsDefaultSurfaceRectChanged();
674 * Adds an implementation of the FrameCallbackInterface.
675 * @param[in] frameCallback An OwnerPointer to the SceneGraph FrameCallback object
676 * @param[in] rootNode A pointer to the root node to apply the FrameCallback to
678 void AddFrameCallback( OwnerPointer< FrameCallback >& frameCallback, const Node* rootNode );
681 * Removes the specified implementation of FrameCallbackInterface.
682 * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to remove.
684 void RemoveFrameCallback( FrameCallbackInterface* frameCallback );
689 UpdateManager(const UpdateManager&);
692 UpdateManager& operator=(const UpdateManager& rhs);
695 * Helper to check whether the update-thread should keep going.
696 * @param[in] elapsedSeconds The time in seconds since the previous update.
697 * @return True if the update-thread should keep going.
699 uint32_t KeepUpdatingCheck( float elapsedSeconds ) const;
702 * Helper to reset all Node properties
703 * @param[in] bufferIndex to use
705 void ResetProperties( BufferIndex bufferIndex );
708 * Perform gesture updates.
709 * @param[in] bufferIndex to use
710 * @param[in] lastVSyncTime The last VSync time in milliseconds.
711 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
712 * @return true, if any properties were updated.
714 bool ProcessGestures( BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds );
717 * Perform animation updates
718 * @param[in] bufferIndex to use
719 * @param[in] elapsedSeconds time since last frame
720 * @return true if at least one animations is currently active or false otherwise
722 bool Animate( BufferIndex bufferIndex, float elapsedSeconds );
725 * Applies constraints to CustomObjects
726 * @param[in] bufferIndex to use
728 void ConstrainCustomObjects( BufferIndex bufferIndex );
731 * Applies constraints to RenderTasks
732 * @param[in] bufferIndex to use
734 void ConstrainRenderTasks( BufferIndex bufferIndex );
737 * Applies constraints to Shaders
738 * @param[in] bufferIndex to use
740 void ConstrainShaders( BufferIndex bufferIndex );
743 * Perform property notification updates
744 * @param[in] bufferIndex to use
746 void ProcessPropertyNotifications( BufferIndex bufferIndex );
749 * Pass shader binaries queued here on to event thread.
751 void ForwardCompiledShadersToEventThread();
754 * Update node shaders, opacity, geometry etc.
755 * @param[in] bufferIndex to use
757 void UpdateNodes( BufferIndex bufferIndex );
761 * @param[in] bufferIndex to use
763 void UpdateRenderers( BufferIndex bufferIndex );
767 // needs to be direct member so that getter for event buffer can be inlined
768 SceneGraphBuffers mSceneGraphBuffers;
775 // Messages for UpdateManager
777 inline void InstallRootMessage( UpdateManager& manager, OwnerPointer<Layer>& root )
779 // Message has ownership of Layer while in transit from event -> update
780 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Layer> >;
782 // Reserve some memory inside the message queue
783 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
785 // Construct message in the message queue memory; note that delete should not be called on the return value
786 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root );
789 inline void UninstallRootMessage( UpdateManager& manager, const Layer* constRoot )
791 // Scene graph thread can destroy this object.
792 Layer* root = const_cast< Layer* >( constRoot );
794 using LocalType = MessageValue1<UpdateManager, Layer*>;
796 // Reserve some memory inside the message queue
797 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
799 // Construct message in the message queue memory; note that delete should not be called on the return value
800 new (slot) LocalType( &manager, &UpdateManager::UninstallRoot, root );
803 inline void AddNodeMessage( UpdateManager& manager, OwnerPointer<Node>& node )
805 // Message has ownership of Node while in transit from event -> update
806 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Node> >;
808 // Reserve some memory inside the message queue
809 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
811 // Construct message in the message queue memory; note that delete should not be called on the return value
812 new (slot) LocalType( &manager, &UpdateManager::AddNode, node );
815 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
817 // Update thread can edit the object
818 Node& parent = const_cast< Node& >( constParent );
819 Node& child = const_cast< Node& >( constChild );
821 using LocalType = MessageValue2<UpdateManager, Node*, Node*>;
823 // Reserve some memory inside the message queue
824 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
826 // Construct message in the message queue memory; note that delete should not be called on the return value
827 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
830 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
832 // Scene graph thread can modify this object.
833 Node& node = const_cast< Node& >( constNode );
835 using LocalType = MessageValue1<UpdateManager, Node*>;
837 // Reserve some memory inside the message queue
838 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
840 // Construct message in the message queue memory; note that delete should not be called on the return value
841 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
844 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
846 // Scene graph thread can destroy this object.
847 Node& node = const_cast< Node& >( constNode );
849 using LocalType = MessageValue1<UpdateManager, Node*>;
851 // Reserve some memory inside the message queue
852 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
854 // Construct message in the message queue memory; note that delete should not be called on the return value
855 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
858 inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& camera )
860 // Message has ownership of Camera while in transit from event -> update
861 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Camera> >;
863 // Reserve some memory inside the message queue
864 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
866 // Construct message in the message queue memory; note that delete should not be called on the return value
867 new (slot) LocalType( &manager, &UpdateManager::AddCamera, camera );
870 inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera )
872 using LocalType = MessageValue1<UpdateManager, Camera*>;
874 // Reserve some memory inside the message queue
875 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
877 // Construct message in the message queue memory; note that delete should not be called on the return value
878 new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, const_cast<Camera*>( camera ) );
881 inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner>& object )
883 // Message has ownership of object while in transit from event -> update
884 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyOwner> >;
886 // Reserve some memory inside the message queue
887 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
889 // Construct message in the message queue memory; note that delete should not be called on the return value
890 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
893 inline void RemoveObjectMessage( UpdateManager& manager, const PropertyOwner* object )
895 using LocalType = MessageValue1<UpdateManager, PropertyOwner*>;
897 // Reserve some memory inside the message queue
898 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
900 // Construct message in the message queue memory; note that delete should not be called on the return value
901 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, const_cast<PropertyOwner*>( object ) );
904 inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation )
906 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Animation> >;
908 // Reserve some memory inside the message queue
909 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
911 // Construct message in the message queue memory; note that delete should not be called on the return value
912 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
915 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
917 // The scene-graph thread owns this object so it can safely edit it.
918 Animation& animation = const_cast< Animation& >( constAnimation );
920 using LocalType = MessageValue1<UpdateManager, Animation*>;
922 // Reserve some memory inside the message queue
923 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
925 // Construct message in the message queue memory; note that delete should not be called on the return value
926 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
929 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
931 // The scene-graph thread owns this object so it can safely edit it.
932 Animation& animation = const_cast< Animation& >( constAnimation );
934 using LocalType = MessageValue1<UpdateManager, Animation*>;
936 // Reserve some memory inside the message queue
937 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
939 // Construct message in the message queue memory; note that delete should not be called on the return value
940 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
943 inline void AddRenderTaskListMessage( UpdateManager& manager, OwnerPointer< SceneGraph::RenderTaskList >& taskList )
945 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::RenderTaskList> >;
947 // Reserve some memory inside the message queue
948 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
950 // Construct message in the message queue memory; note that delete should not be called on the return value
951 new (slot) LocalType( &manager, &UpdateManager::AddRenderTaskList, taskList );
954 inline void RemoveRenderTaskListMessage( UpdateManager& manager, const RenderTaskList& constTaskList )
956 // The scene-graph thread owns this object so it can safely edit it.
957 RenderTaskList& taskList = const_cast< RenderTaskList& >( constTaskList );
959 using LocalType = MessageValue1<UpdateManager, RenderTaskList*>;
961 // Reserve some memory inside the message queue
962 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
964 // Construct message in the message queue memory; note that delete should not be called on the return value
965 new (slot) LocalType( &manager, &UpdateManager::RemoveRenderTaskList, &taskList );
968 inline void AddSceneMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Scene >& scene )
970 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Scene> >;
972 // Reserve some memory inside the message queue
973 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
975 // Construct message in the message queue memory; note that delete should not be called on the return value
976 new (slot) LocalType( &manager, &UpdateManager::AddScene, scene );
979 inline void RemoveSceneMessage( UpdateManager& manager, const SceneGraph::Scene& constScene )
981 // The scene-graph thread owns this object so it can safely edit it.
982 Scene& scene = const_cast< Scene& >( constScene );
984 using LocalType = MessageValue1<UpdateManager, Scene*>;
986 // Reserve some memory inside the message queue
987 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
989 // Construct message in the message queue memory; note that delete should not be called on the return value
990 new (slot) LocalType( &manager, &UpdateManager::RemoveScene, &scene );
993 inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification )
995 // Message has ownership of PropertyNotification while in transit from event -> update
996 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyNotification> >;
998 // Reserve some memory inside the message queue
999 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1001 // Construct message in the message queue memory; note that delete should not be called on the return value
1002 new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
1005 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
1007 // The scene-graph thread owns this object so it can safely edit it.
1008 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
1010 using LocalType = MessageValue1<UpdateManager, PropertyNotification*>;
1012 // Reserve some memory inside the message queue
1013 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1015 // Construct message in the message queue memory; note that delete should not be called on the return value
1016 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
1019 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
1020 const PropertyNotification* constPropertyNotification,
1021 PropertyNotification::NotifyMode notifyMode )
1023 // The scene-graph thread owns this object so it can safely edit it.
1024 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
1026 using LocalType = MessageValue2<UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode>;
1028 // Reserve some memory inside the message queue
1029 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1031 // Construct message in the message queue memory; note that delete should not be called on the return value
1032 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
1035 // The render thread can safely change the Shader
1036 inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& shader )
1038 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Shader> >;
1040 // Reserve some memory inside the message queue
1041 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1043 // Construct message in the message queue memory; note that delete should not be called on the return value
1044 new (slot) LocalType( &manager, &UpdateManager::AddShader, shader );
1047 // The render thread can safely change the Shader
1048 inline void RemoveShaderMessage( UpdateManager& manager, const Shader* shader )
1050 using LocalType = MessageValue1<UpdateManager, Shader*>;
1052 // Reserve some memory inside the message queue
1053 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1055 // Construct message in the message queue memory; note that delete should not be called on the return value
1056 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, const_cast<Shader*>( shader ) );
1059 inline void SetShaderProgramMessage( UpdateManager& manager,
1060 const Shader& shader,
1061 Internal::ShaderDataPtr shaderData,
1062 bool modifiesGeometry )
1064 using LocalType = MessageValue3<UpdateManager, Shader*, Internal::ShaderDataPtr, bool>;
1066 // Reserve some memory inside the message queue
1067 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1069 // Construct message in the message queue memory; note that delete should not be called on the return value
1070 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, const_cast<Shader*>( &shader ), shaderData, modifiesGeometry );
1073 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int32_t>& rect )
1075 using LocalType = MessageValue1<UpdateManager, Rect<int32_t> >;
1077 // Reserve some memory inside the message queue
1078 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1080 // Construct message in the message queue memory; note that delete should not be called on the return value
1081 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
1084 inline void SurfaceReplacedMessage( UpdateManager& manager, const SceneGraph::Scene& constScene )
1086 // The scene-graph thread owns this object so it can safely edit it.
1087 Scene& scene = const_cast< Scene& >( constScene );
1089 using LocalType = MessageValue1<UpdateManager, Scene*>;
1091 // Reserve some memory inside the message queue
1092 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1094 // Construct message in the message queue memory; note that delete should not be called on the return value
1095 new (slot) LocalType( &manager, &UpdateManager::SurfaceReplaced, &scene );
1098 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
1100 using LocalType = MessageValue1<UpdateManager, float>;
1102 // Reserve some memory inside the message queue
1103 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1105 // Construct message in the message queue memory; note that delete should not be called on the return value
1106 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
1109 inline void SetRenderingBehaviorMessage( UpdateManager& manager, DevelStage::Rendering renderingBehavior )
1111 using LocalType = MessageValue1<UpdateManager, DevelStage::Rendering>;
1113 // Reserve some memory inside the message queue
1114 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1116 // Construct message in the message queue memory; note that delete should not be called on the return value
1117 new (slot) LocalType( &manager, &UpdateManager::SetRenderingBehavior, renderingBehavior );
1120 inline void RequestRenderingMessage( UpdateManager& manager )
1122 using LocalType = Message<UpdateManager>;
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::RequestRendering );
1132 * Create a message for setting the depth of a layer
1133 * @param[in] manager The update manager
1134 * @param[in] layers list of layers
1135 * @param[in] rootLayer The rool layer
1137 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, const Layer* rootLayer )
1139 using LocalType = MessageValue2<UpdateManager, std::vector<Layer*>, const Layer*>;
1141 // Reserve some memory inside the message queue
1142 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1144 // Construct message in the message queue memory; note that delete should not be called on the return value
1145 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, rootLayer );
1148 inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >& object )
1150 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Renderer> >;
1152 // Reserve some memory inside the message queue
1153 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1154 // Construct message in the message queue memory; note that delete should not be called on the return value
1155 new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object );
1158 inline void RemoveRendererMessage( UpdateManager& manager, const Renderer& object )
1160 using LocalType = MessageValue1<UpdateManager, Renderer*>;
1162 // Reserve some memory inside the message queue
1163 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1164 // Construct message in the message queue memory; note that delete should not be called on the return value
1165 new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, const_cast<Renderer*>( &object ) );
1168 // The render thread can safely change the Shader
1169 inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureSet >& textureSet )
1171 using LocalType = MessageValue1<UpdateManager, OwnerPointer<TextureSet> >;
1173 // Reserve some memory inside the message queue
1174 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1176 // Construct message in the message queue memory; note that delete should not be called on the return value
1177 new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, textureSet );
1180 // The render thread can safely change the Shader
1181 inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& textureSet )
1183 using LocalType = MessageValue1<UpdateManager, TextureSet*>;
1185 // Reserve some memory inside the message queue
1186 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1188 // Construct message in the message queue memory; note that delete should not be called on the return value
1189 new (slot) LocalType( &manager, &UpdateManager::RemoveTextureSet, &textureSet );
1192 inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sampler >& sampler )
1194 // Message has ownership of Sampler while in transit from event -> update
1195 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Sampler> >;
1197 // Reserve some memory inside the message queue
1198 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1200 // Construct message in the message queue memory; note that delete should not be called on the return value
1201 new (slot) LocalType( &manager, &UpdateManager::AddSampler, sampler );
1204 inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
1206 using LocalType = MessageValue1<UpdateManager, Render::Sampler*>;
1208 // Reserve some memory inside the message queue
1209 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1211 // Construct message in the message queue memory; note that delete should not be called on the return value
1212 new (slot) LocalType( &manager, &UpdateManager::RemoveSampler, &sampler );
1215 inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode )
1217 using LocalType = MessageValue3<UpdateManager, Render::Sampler*, uint32_t, uint32_t>;
1219 // Reserve some memory inside the message queue
1220 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1222 // Construct message in the message queue memory; note that delete should not be called on the return value
1223 new (slot) LocalType( &manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode );
1226 inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode )
1228 using LocalType = MessageValue4<UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t>;
1230 // Reserve some memory inside the message queue
1231 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1233 // Construct message in the message queue memory; note that delete should not be called on the return value
1234 new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode );
1237 inline void AddVertexBuffer( UpdateManager& manager, OwnerPointer< Render::VertexBuffer >& vertexBuffer )
1239 // Message has ownership of vertexBuffer while in transit from event -> update
1240 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::VertexBuffer> >;
1242 // Reserve some memory inside the message queue
1243 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1245 // Construct message in the message queue memory; note that delete should not be called on the return value
1246 new (slot) LocalType( &manager, &UpdateManager::AddVertexBuffer, vertexBuffer );
1249 inline void RemoveVertexBuffer( UpdateManager& manager, Render::VertexBuffer& vertexBuffer )
1251 using LocalType = MessageValue1<UpdateManager, Render::VertexBuffer*>;
1253 // Reserve some memory inside the message queue
1254 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1256 // Construct message in the message queue memory; note that delete should not be called on the return value
1257 new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &vertexBuffer );
1260 inline void SetVertexBufferFormat( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format )
1262 // Message has ownership of VertexBuffer::Format while in transit from event -> update
1263 using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, OwnerPointer<Render::VertexBuffer::Format> >;
1265 // Reserve some memory inside the message queue
1266 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1268 // Construct message in the message queue memory; note that delete should not be called on the return value
1269 new (slot) LocalType( &manager, &UpdateManager::SetVertexBufferFormat, &vertexBuffer, format );
1272 inline void SetVertexBufferData( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Vector<uint8_t> >& data, uint32_t size )
1274 // Message has ownership of VertexBuffer data while in transit from event -> update
1275 using LocalType = MessageValue3<UpdateManager, Render::VertexBuffer*, OwnerPointer<Vector<uint8_t> >, uint32_t>;
1277 // Reserve some memory inside the message queue
1278 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1280 // Construct message in the message queue memory; note that delete should not be called on the return value
1281 new (slot) LocalType( &manager, &UpdateManager::SetVertexBufferData, &vertexBuffer, data, size );
1284 inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry >& geometry )
1286 // Message has ownership of Geometry while in transit from event -> update
1287 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Geometry> >;
1289 // Reserve some memory inside the message queue
1290 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1292 // Construct message in the message queue memory; note that delete should not be called on the return value
1293 new (slot) LocalType( &manager, &UpdateManager::AddGeometry, geometry );
1296 inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry )
1298 using LocalType = MessageValue1<UpdateManager, Render::Geometry*>;
1300 // Reserve some memory inside the message queue
1301 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1303 // Construct message in the message queue memory; note that delete should not be called on the return value
1304 new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry );
1307 inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer )
1309 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
1311 // Reserve some memory inside the message queue
1312 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1314 // Construct message in the message queue memory; note that delete should not be called on the return value
1315 new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer) );
1318 inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer )
1320 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
1322 // Reserve some memory inside the message queue
1323 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1325 // Construct message in the message queue memory; note that delete should not be called on the return value
1326 new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer) );
1329 // Custom message type for SetIndexBuffer() used to move data with Vector::Swap()
1330 template< typename T >
1331 class IndexBufferMessage : public MessageBase
1336 * Constructor which does a Vector::Swap()
1338 IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector<uint16_t>& indices )
1340 mManager( manager ),
1341 mRenderGeometry( geometry )
1343 mIndices.Swap( indices );
1347 * Virtual destructor
1349 ~IndexBufferMessage() override = default;
1352 * @copydoc MessageBase::Process
1354 void Process( BufferIndex /*bufferIndex*/ ) override
1356 DALI_ASSERT_DEBUG( mManager && "Message does not have an object" );
1357 mManager->SetIndexBuffer( mRenderGeometry, mIndices );
1363 Render::Geometry* mRenderGeometry;
1364 Dali::Vector<uint16_t> mIndices;
1367 inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<uint16_t>& indices )
1369 using LocalType = IndexBufferMessage<UpdateManager>;
1371 // Reserve some memory inside the message queue
1372 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1374 // Construct message in the message queue memory; note that delete should not be called on the return value
1375 new (slot) LocalType( &manager, &geometry, indices );
1378 inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType )
1380 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, uint32_t>;
1382 // Reserve some memory inside the message queue
1383 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1385 // Construct message in the message queue memory; note that delete should not be called on the return value
1386 new (slot) LocalType( &manager, &UpdateManager::SetGeometryType, &geometry, geometryType );
1389 inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& texture )
1391 // Message has ownership of Texture while in transit from event -> update
1392 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Texture> >;
1394 // Reserve some memory inside the message queue
1395 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1397 // Construct message in the message queue memory; note that delete should not be called on the return value
1398 new (slot) LocalType( &manager, &UpdateManager::AddTexture, texture );
1401 inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture )
1403 using LocalType = MessageValue1<UpdateManager, Render::Texture*>;
1405 // Reserve some memory inside the message queue
1406 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1408 // Construct message in the message queue memory; note that delete should not be called on the return value
1409 new (slot) LocalType( &manager, &UpdateManager::RemoveTexture, &texture );
1412 inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& texture, PixelDataPtr pixelData, const Texture::UploadParams& params )
1414 using LocalType = MessageValue3<UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams>;
1416 // Reserve some memory inside the message queue
1417 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1419 // Construct message in the message queue memory; note that delete should not be called on the return value
1420 new (slot) LocalType( &manager, &UpdateManager::UploadTexture, &texture, pixelData, params );
1423 inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& texture )
1425 using LocalType = MessageValue1<UpdateManager, Render::Texture*>;
1427 // Reserve some memory inside the message queue
1428 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1430 // Construct message in the message queue memory; note that delete should not be called on the return value
1431 new (slot) LocalType( &manager, &UpdateManager::GenerateMipmaps, &texture );
1435 inline void AddFrameBuffer( UpdateManager& manager, OwnerPointer< Render::FrameBuffer >& frameBuffer )
1437 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::FrameBuffer> >;
1439 // Reserve some memory inside the message queue
1440 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1442 // Construct message in the message queue memory; note that delete should not be called on the return value
1443 new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, frameBuffer );
1446 inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
1448 using LocalType = MessageValue1<UpdateManager, Render::FrameBuffer*>;
1450 // Reserve some memory inside the message queue
1451 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1453 // Construct message in the message queue memory; note that delete should not be called on the return value
1454 new (slot) LocalType( &manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer );
1457 inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer )
1459 using LocalType = MessageValue4<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t>;
1461 // Reserve some memory inside the message queue
1462 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1464 // Construct message in the message queue memory; note that delete should not be called on the return value
1465 new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
1468 inline void AttachDepthTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
1470 using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
1472 // Reserve some memory inside the message queue
1473 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1475 // Construct message in the message queue memory; note that delete should not be called on the return value
1476 new (slot) LocalType( &manager, &UpdateManager::AttachDepthTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel );
1479 inline void AttachDepthStencilTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel )
1481 using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
1483 // Reserve some memory inside the message queue
1484 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1486 // Construct message in the message queue memory; note that delete should not be called on the return value
1487 new (slot) LocalType( &manager, &UpdateManager::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel );
1490 inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDepths >& nodeDepths )
1492 using LocalType = MessageValue1<UpdateManager, OwnerPointer<NodeDepths> >;
1494 // Reserve some memory inside the message queue
1495 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1497 // Construct message in the message queue memory; note that delete should not be called on the return value
1498 new (slot) LocalType( &manager, &UpdateManager::SetDepthIndices, nodeDepths );
1501 inline void AddResetterMessage( UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter )
1503 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyResetterBase> >;
1505 // Reserve some memory inside the message queue
1506 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1508 // Construct message in the message queue memory; note that delete should not be called on the return value
1509 new (slot) LocalType( &manager, &UpdateManager::AddPropertyResetter, resetter );
1512 inline void AddFrameCallbackMessage( UpdateManager& manager, OwnerPointer< FrameCallback >& frameCallback, const Node& rootNode )
1514 using LocalType = MessageValue2<UpdateManager, OwnerPointer<FrameCallback>, const Node*>;
1516 // Reserve some memory inside the message queue
1517 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1519 // Construct message in the message queue memory; note that delete should not be called on the return value
1520 new (slot) LocalType( &manager, &UpdateManager::AddFrameCallback, frameCallback, &rootNode );
1523 inline void RemoveFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback )
1525 using LocalType = MessageValue1<UpdateManager, FrameCallbackInterface*>;
1527 // Reserve some memory inside the message queue
1528 uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
1530 // Construct message in the message queue memory; note that delete should not be called on the return value
1531 new (slot) LocalType( &manager, &UpdateManager::RemoveFrameCallback, &frameCallback );
1534 } // namespace SceneGraph
1536 } // namespace Internal
1540 #endif // DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H