1 #ifndef DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
2 #define DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
5 * Copyright (c) 2024 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/dali-common.h>
23 #include <dali/public-api/common/vector-wrapper.h>
25 #include <dali/devel-api/common/stage-devel.h>
27 #include <dali/internal/common/message.h>
28 #include <dali/internal/common/shader-saver.h>
29 #include <dali/internal/common/type-abstraction-enums.h>
30 #include <dali/internal/event/common/event-thread-services.h>
31 #include <dali/internal/event/rendering/texture-impl.h>
32 #include <dali/internal/render/renderers/render-texture-key.h> // For RenderTextureKey
33 #include <dali/internal/render/renderers/render-texture.h> // For OwnerPointer<Render::Texture>
34 #include <dali/internal/render/renderers/render-vertex-buffer.h>
35 #include <dali/internal/render/shaders/render-shader.h> // for OwnerPointer< Shader >
36 #include <dali/internal/update/animation/scene-graph-animation.h>
37 #include <dali/internal/update/common/node-resetter.h>
38 #include <dali/internal/update/common/property-resetter.h>
39 #include <dali/internal/update/common/renderer-resetter.h>
40 #include <dali/internal/update/common/resetter-manager.h>
41 #include <dali/internal/update/common/scene-graph-buffers.h>
42 #include <dali/internal/update/common/scene-graph-property-notification.h>
43 #include <dali/internal/update/common/scene-graph-scene.h>
44 #include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
45 #include <dali/internal/update/manager/scene-graph-frame-callback.h> // for OwnerPointer< FrameCallback >
46 #include <dali/internal/update/nodes/node.h>
47 #include <dali/internal/update/nodes/scene-graph-layer.h>
48 #include <dali/internal/update/render-tasks/scene-graph-camera.h>
49 #include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
50 #include <dali/internal/update/rendering/scene-graph-renderer.h> // for OwnerPointer< Renderer >
51 #include <dali/internal/update/rendering/scene-graph-texture-set.h> // for OwnerPointer< TextureSet >
53 #include <dali/graphics-api/graphics-texture-upload-helper.h> // for Graphics::UploadParams
60 class FrameCallbackInterface;
64 class RenderController;
66 } // namespace Integration
70 class PropertyNotifier;
71 class NotificationManager;
72 class CompleteNotificationInterface;
80 // value types used by messages
82 struct ParameterType<PropertyNotification::NotifyMode>
83 : public BasicType<PropertyNotification::NotifyMode>
92 class RenderTaskProcessor;
97 * UpdateManager maintains a scene graph i.e. a tree of nodes as well as
98 * other scene graph property owning objects.
99 * It controls the Update traversal, in which nodes are repositioned/animated,
100 * and organizes the the culling and rendering of the scene.
101 * It also maintains the lifecycle of nodes and other property owners that are
102 * disconnected from the scene graph.
104 class UpdateManager : public ShaderSaver, public ResetterManager
108 * Construct a new UpdateManager.
109 * @param[in] notificationManager This should be notified when animations have finished.
110 * @param[in] animationPlaylist The CompleteNotificationInterface that handles the animations
111 * @param[in] propertyNotifier The PropertyNotifier
112 * @param[in] controller After messages are flushed, we request a render from the RenderController.
113 * @param[in] renderManager This is responsible for rendering the results of each "update".
114 * @param[in] renderQueue Used to queue messages for the next render.
115 * @param[in] renderTaskProcessor Handles RenderTasks and RenderInstrucitons.
117 UpdateManager(NotificationManager& notificationManager,
118 CompleteNotificationInterface& animationPlaylist,
119 PropertyNotifier& propertyNotifier,
120 Integration::RenderController& controller,
121 RenderManager& renderManager,
122 RenderQueue& renderQueue,
123 RenderTaskProcessor& renderTaskProcessor);
128 ~UpdateManager() override;
130 // Node connection methods
133 * Installs a new layer as the root node.
134 * @pre The layer is of derived Node type Layer.
135 * @pre The layer does not have a parent.
136 * @param[in] layer The new root node.
137 * @post The node is owned by UpdateManager.
139 void InstallRoot(OwnerPointer<Layer>& layer);
142 * Uninstalls the root node.
143 * @pre The layer is of derived Node type Layer.
144 * @pre The layer does not have a parent.
145 * @param[in] layer The root node.
146 * @post The node is owned by UpdateManager.
148 void UninstallRoot(Layer* layer);
151 * Add a Node; UpdateManager takes ownership.
152 * @pre The node does not have a parent.
153 * @note even though nodes are pool allocated, they also contain other heap allocated data, thus using OwnerPointer when transferring the data
154 * @param[in] node The node to add.
156 void AddNode(OwnerPointer<Node>& node);
159 * Connect a Node to the scene-graph.
160 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
161 * @pre The node does not already have a parent.
162 * @param[in] parent The new parent node.
164 void ConnectNode(Node* parent, Node* node);
167 * Disconnect a Node from the scene-graph.
168 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
169 * @pre The node has a parent.
170 * @param[in] node The node to disconnect.
172 void DisconnectNode(Node* node);
175 * Destroy a Node owned by UpdateManager.
176 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
177 * In the following update, the previously queued Nodes may be deleted.
178 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
179 * @param[in] node The node to destroy.
181 void DestroyNode(Node* node);
184 * Add a newly created object.
185 * @param[in] object The object to add.
186 * @post The object is owned by UpdateManager.
188 void AddObject(OwnerPointer<PropertyOwner>& object);
192 * @param[in] object The object to remove.
194 void RemoveObject(PropertyOwner* object);
197 * Add a newly created render task list.
198 * @param[in] taskList The render task list to add.
199 * @post The render task list is owned by UpdateManager.
201 void AddRenderTaskList(OwnerPointer<RenderTaskList>& taskList);
204 * Remove a render task list.
205 * @param[in] taskList The render task list to remove.
207 void RemoveRenderTaskList(RenderTaskList* taskList);
210 * Add a newly created scene.
211 * @param[in] scene The scene to add.
212 * @post The scene is owned by UpdateManager.
214 void AddScene(OwnerPointer<Scene>& scene);
218 * @param[in] scene The scene to remove.
220 void RemoveScene(Scene* scene);
225 * Add a newly created animation.
226 * @param[in] animation The animation to add.
227 * @post The animation is owned by UpdateManager.
229 void AddAnimation(OwnerPointer<SceneGraph::Animation>& animation);
233 * @param[in] animation The animation to stop.
235 void StopAnimation(Animation* animation);
238 * Remove an animation.
239 * @param[in] animation The animation to remove.
241 void RemoveAnimation(Animation* animation);
244 * Query whether any animations are currently running.
245 * @return True if any animations are running.
247 bool IsAnimationRunning() const;
252 * @copydoc Dali::Internal::SceneGraph::ResetterManager::AddPropertyResetter()
254 void AddPropertyResetter(OwnerPointer<PropertyResetterBase>& propertyResetter) override;
257 * @copydoc Dali::Internal::SceneGraph::ResetterManager::AddNodeResetter()
259 void AddNodeResetter(const Node& node) override;
262 * @copydoc Dali::Internal::SceneGraph::ResetterManager::AddRendererResetter()
264 void AddRendererResetter(const Renderer& renderer) override;
266 // Property Notification
269 * Add a newly created property notification
270 * @param[in] propertyNotification The notification to add
271 * @post The propertyNotification is owned by UpdateManager.
273 void AddPropertyNotification(OwnerPointer<PropertyNotification>& propertyNotification);
276 * Remove a property notification
277 * @param[in] propertyNotification The notification to remove
279 void RemovePropertyNotification(PropertyNotification* propertyNotification);
282 * Set Notify state for PropertyNotification
283 * @param[in] propertyNotification The notification to remove
284 * @param[in] notifyMode The notification mode.
286 void PropertyNotificationSetNotify(PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode);
291 * Add a newly created shader.
292 * @param[in] shader The shader to add.
293 * @post The shader is owned by the UpdateManager.
295 void AddShader(OwnerPointer<Shader>& shader);
299 * @pre The shader has been added to the UpdateManager.
300 * @param[in] shader The shader to remove.
301 * @post The shader is destroyed.
303 void RemoveShader(Shader* shader);
306 * Set the shader data for a Shader object
307 * @param[in] shader The shader to modify
308 * @param[in] shaderData Source code, hash over source, and optional compiled binary for the shader program
310 void SetShaderData(Shader* shader, Internal::ShaderDataPtr shaderData);
313 * @brief Accept compiled shaders passed back on render thread for saving.
314 * @param[in] shaderData Source code, hash over source, and corresponding compiled binary to be saved.
316 void SaveBinary(Internal::ShaderDataPtr shaderData) override;
319 * @brief Set the destination for compiled shader binaries to be passed on to.
320 * The dispatcher passed in will be called from the update thread.
321 * @param[in] upstream A sink for ShaderDatas to be passed into.
323 void SetShaderSaver(ShaderSaver& upstream);
328 * Add a new renderer to scene
329 * @param renderer to add
331 void AddRenderer(const RendererKey& renderer);
334 * Remove a renderer from scene
335 * @param renderer to remove
337 void RemoveRenderer(const RendererKey& renderer);
340 * Attach a renderer to node
341 * @param renderer to attach
343 void AttachRenderer(Node* node, Renderer* renderer);
348 * Set the pan gesture processor.
349 * Pan Gesture processor lives for the lifetime of UpdateManager
350 * @param[in] gesture The gesture processor.
351 * @post The gestureProcessor is owned by the UpdateManager.
353 void SetPanGestureProcessor(PanGesture* gestureProcessor);
358 * Add a newly created TextureSet.
359 * @param[in] textureSet The texture set to add.
360 * @post The TextureSet is owned by the UpdateManager.
362 void AddTextureSet(OwnerPointer<TextureSet>& textureSet);
365 * Remove a TextureSet.
366 * @pre The TextureSet has been added to the UpdateManager.
367 * @param[in] textureSet The TextureSet to remove.
368 * @post The TextureSet is destroyed.
370 void RemoveTextureSet(TextureSet* textureSet);
375 * Get the scene graph side list of RenderTasks.
376 * @param[in] systemLevel True if using the system-level overlay.
377 * @return The list of render tasks
379 RenderTaskList* GetRenderTaskList(bool systemLevel);
381 // Message queue handling
384 * Reserve space for another message in the queue; this must then be initialized by the caller.
385 * The message will be read from the update-thread after the next FlushMessages is called.
386 * @post Calling this method may invalidate any previously returned slots.
387 * @param[in] size The message size with respect to the size of type "char".
388 * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
389 * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
390 * @return A pointer to the first char allocated for the message.
392 uint32_t* ReserveMessageSlot(uint32_t size, bool updateScene = true);
395 * @return the current event-buffer index.
397 BufferIndex GetEventBufferIndex() const
399 // inlined as its called often from event thread
400 return mSceneGraphBuffers.GetEventBufferIndex();
404 * Called by the event-thread to signal that FlushQueue will be called
405 * e.g. when it has finished event processing.
407 void EventProcessingStarted();
410 * Called by the event-thread to signal that we need to queue messages.
412 void EventProcessingFinished();
415 * Flush the set of messages, which were previously stored with QueueMessage().
416 * Calls to this thread-safe method should be minimized, to avoid thread blocking.
418 * @return True if there are messages to process.
423 * Add a new sampler to RenderManager
424 * @param[in] sampler The sampler to add
425 * @post Sends a message to RenderManager to add the sampler.
426 * The sampler will be owned by RenderManager
428 void AddSampler(OwnerPointer<Render::Sampler>& sampler);
431 * Removes an existing sampler from RenderManager
432 * @param[in] sampler The sampler to remove
433 * @post The sampler will be destroyed in the render thread
435 void RemoveSampler(Render::Sampler* sampler);
438 * Sets the filter modes for an existing sampler
439 * @param[in] sampler The sampler
440 * @param[in] minFilterMode The filter to use under minification
441 * @param[in] magFilterMode The filter to use under magnification
443 void SetFilterMode(Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode);
446 * Sets the wrap mode for an existing sampler
447 * @param[in] sampler The sampler
448 * @param[in] rWrapMode Wrapping mode in z direction
449 * @param[in] sWrapMode Wrapping mode in x direction
450 * @param[in] tWrapMode Wrapping mode in y direction
452 void SetWrapMode(Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode);
455 * Add a new property buffer to RenderManager
456 * @param[in] propertryBuffer The property buffer to add
457 * @post Sends a message to RenderManager to add the property buffer.
458 * The property buffer will be owned by RenderManager
460 void AddVertexBuffer(OwnerPointer<Render::VertexBuffer>& propertryBuffer);
463 * Removes an existing VertexBuffer from RenderManager
464 * @param[in] propertryBuffer The property buffer to remove
465 * @post The property buffer will be destroyed in the render thread
467 void RemoveVertexBuffer(Render::VertexBuffer* propertryBuffer);
470 * Sets the format of an existing property buffer
471 * @param[in] vertexBuffer The property buffer.
472 * @param[in] format The new format of the buffer
473 * @post Sends a message to RenderManager to set the new format to the property buffer.
475 void SetVertexBufferFormat(Render::VertexBuffer* vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format);
478 * Sets the data of an existing property buffer
479 * @param[in] vertexBuffer The property buffer.
480 * @param[in] data The new data of the buffer
481 * @param[in] size The new size of the buffer
482 * @post Sends a message to RenderManager to set the new data to the property buffer.
484 void SetVertexBufferData(Render::VertexBuffer* vertexBuffer, OwnerPointer<Vector<uint8_t>>& data, uint32_t size);
487 * Sets the divisor of a vertex buffer. This is used by the GPU to provide
489 * @param[in] vertexBuffer The property buffer.
490 * @param[in] divisor The instance divisor. 0 to turn instancing off.
492 void SetVertexBufferDivisor(Render::VertexBuffer* vertexBuffer, uint32_t divisor);
494 * Sets vertex buffer update callback
495 * @param[in] vertexBuffer
496 * @param[in] callback
498 void SetVertexBufferUpdateCallback(Render::VertexBuffer* vertexBuffer, Dali::VertexBufferUpdateCallback* callback);
501 * Adds a geometry to the RenderManager
502 * @param[in] geometry The geometry to add
503 * @post Sends a message to RenderManager to add the Geometry
504 * The geometry will be owned by RenderManager
506 void AddGeometry(OwnerPointer<Render::Geometry>& geometry);
509 * Removes an existing Geometry from RenderManager
510 * @param[in] geometry The geometry to remove
511 * @post The geometry will be destroyed in the render thread
513 void RemoveGeometry(Render::Geometry* geometry);
516 * Sets the geometry type of an existing Geometry
517 * @param[in] geometry The geometry
518 * @param[in] geometryType The type of the geometry
520 void SetGeometryType(Render::Geometry* geometry, uint32_t geometryType);
523 * Sets the index buffer to be used by a geometry
524 * @param[in] geometry The geometry
525 * @param[in] indices A vector containing the indices for the geometry
527 void SetIndexBuffer(Render::Geometry* geometry, Render::Geometry::Uint16ContainerType& indices);
530 * Sets the index buffer to be used by a geometry
531 * @param[in] geometry The geometry
532 * @param[in] indices A vector containing the indices for the geometry
534 void SetIndexBuffer(Render::Geometry* geometry, Render::Geometry::Uint32ContainerType& indices);
537 * Adds a vertex buffer to a geometry
538 * @param[in] geometry The geometry
539 * @param[in] vertexBuffer The property buffer
541 void AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
544 * Removes a vertex buffer from a geometry
545 * @param[in] geometry The geometry
546 * @param[in] vertexBuffer The property buffer
548 void RemoveVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
551 * Adds a texture to the render manager
552 * @param[in] texture The texture to add
553 * The texture will be owned by RenderManager
555 void AddTexture(const Render::TextureKey& texture);
558 * Removes a texture from the render manager
559 * @param[in] texture The texture to remove
560 * @post The texture will be destroyed in the render thread
562 void RemoveTexture(const Render::TextureKey& texture);
565 * Uploads data to a texture owned by the RenderManager
566 * @param[in] texture The texture
567 * @param[in] pixelData The pixel data object
568 * @param[in] params The parameters for the upload
570 void UploadTexture(const Render::TextureKey& texture, PixelDataPtr pixelData, const Graphics::UploadParams& params);
573 * Generates mipmaps for a texture owned by the RenderManager
574 * @param[in] texture The texture
576 void GenerateMipmaps(const Render::TextureKey& texture);
579 * Set the texture size owned by the RenderManager
580 * @param[in] texture The texture
581 * @param[in] size The texture size
583 void SetTextureSize(const Render::TextureKey& texture, const Dali::ImageDimensions& size);
586 * Set the texture pixel format owned by the RenderManager
587 * @param[in] texture The texture
588 * @param[in] pixelFormat The texture pixel format
590 void SetTextureFormat(const Render::TextureKey& texture, Dali::Pixel::Format pixelFormat);
593 * Adds a framebuffer to the render manager
594 * @param[in] frameBuffer The framebuffer to add
595 * The framebuffer will be owned by RenderManager
597 void AddFrameBuffer(OwnerPointer<Render::FrameBuffer>& frameBuffer);
600 * Removes a FrameBuffer from the render manager
601 * @param[in] frameBuffer The FrameBuffer to remove
602 * @post The FrameBuffer will be destroyed in the render thread
604 void RemoveFrameBuffer(Render::FrameBuffer* frameBuffer);
607 * Attach a texture as color output to an existing FrameBuffer
608 * @param[in] frameBuffer The FrameBuffer
609 * @param[in] texture The texture that will be used as output when rendering
610 * @param[in] mipmapLevel The mipmap of the texture to be attached
611 * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
613 void AttachColorTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face);
616 * Attach a texture as depth output to an existing FrameBuffer
617 * @param[in] frameBuffer The FrameBuffer
618 * @param[in] texture The texture that will be used as output when rendering
619 * @param[in] mipmapLevel The mipmap of the texture to be attached
621 void AttachDepthTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
624 * Attach a texture as depth/stencil output to an existing FrameBuffer
625 * @param[in] frameBuffer The FrameBuffer
626 * @param[in] texture The texture that will be used as output when rendering
627 * @param[in] mipmapLevel The mipmap of the texture to be attached
629 void AttachDepthStencilTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
632 * Set a multisampling level value as texture output to the existing FrameBuffer
633 * @param[in] frameBuffer The FrameBuffer
634 * @param[in] multiSamplingLevel The level of multisampling
636 void SetMultiSamplingLevelToFrameBuffer(Render::FrameBuffer* frameBuffer, uint8_t multiSamplingLevel);
639 * This is called when the surface of the scene has been replaced.
640 * @param[in] scene The scene.
642 void SurfaceReplaced(Scene* scene);
646 * Performs an Update traversal on the scene-graph.
647 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
648 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
649 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
650 * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
651 * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
652 * @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
653 * @return True if further updates are required e.g. during animations.
655 uint32_t Update(float elapsedSeconds,
656 uint32_t lastVSyncTimeMilliseconds,
657 uint32_t nextVSyncTimeMilliseconds,
658 bool renderToFboEnabled,
659 bool isRenderingToFbo,
663 * This is called after rendering all the scenes in the next frame.
668 * @copydoc Dali::Stage::KeepRendering()
670 void KeepRendering(float durationSeconds);
673 * @copydoc Dali::DevelStage::SetRenderingBehavior()
675 void SetRenderingBehavior(DevelStage::Rendering renderingBehavior);
678 * Request to render the current frame
679 * @note This is a temporary workaround (to be removed in the future) to request the rendering of
680 * the current frame if the color or visibility of any actor is updated. It MUST NOT be used
681 * for any other purposes.
683 void RequestRendering();
686 * @brief Get the active Node pointer by node id.
688 * @param[in] nodeId The id of node what we want to get.
689 * @return The pointer of node, or nullptr if given node id is not exist, or discarded.
691 Node* GetNodePointerById(uint32_t nodeId) const;
694 * Sets the depths of all layers.
695 * @param layers The layers in depth order.
696 * @param[in] rootLayer The root layer of the sorted layers.
698 void SetLayerDepths(const std::vector<Layer*>& layers, const Layer* rootLayer);
701 * Set the depth indices of all nodes (in LayerUI's)
702 * @param[in] nodeDepths A vector of nodes and associated depth indices
704 void SetDepthIndices(OwnerPointer<NodeDepths>& nodeDepths);
707 * Adds an implementation of the FrameCallbackInterface.
708 * @param[in] frameCallback An OwnerPointer to the SceneGraph FrameCallback object
709 * @param[in] rootNode A pointer to the root node to apply the FrameCallback to
711 void AddFrameCallback(OwnerPointer<FrameCallback>& frameCallback, const Node* rootNode);
714 * Removes the specified implementation of FrameCallbackInterface.
715 * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to remove.
717 void RemoveFrameCallback(FrameCallbackInterface* frameCallback);
720 * Notify the specified implementation of FrameCallbackInterface with the given sync point.
721 * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to notify.
722 * @param[in] syncPoint The unique sync point to notify with.
724 void NotifyFrameCallback(FrameCallbackInterface* frameCallback, Dali::UpdateProxy::NotifySyncPoint syncPoint);
727 * Get the update message queue capacity (mutex locked)
729 std::size_t GetUpdateMessageQueueCapacity() const;
732 * Get the render message queue capacity
734 std::size_t GetRenderMessageQueueCapacity() const;
737 * Get the render instruction capacity
739 std::size_t GetRenderInstructionCapacity() const;
743 UpdateManager(const UpdateManager&);
746 UpdateManager& operator=(const UpdateManager& rhs);
749 * Add a camera on scene
750 * @param[in] camera The camera to add
752 void AddCamera(Camera* camera);
755 * Remove a camera from scene
756 * @param[in] camera to remove
758 void RemoveCamera(Camera* camera);
761 * Helper to check whether the update-thread should keep going.
762 * @param[in] elapsedSeconds The time in seconds since the previous update.
763 * @return True if the update-thread should keep going.
765 uint32_t KeepUpdatingCheck(float elapsedSeconds) const;
768 * Helper to reset all Node properties
769 * @param[in] bufferIndex to use
771 void ResetProperties(BufferIndex bufferIndex);
774 * Perform gesture updates.
775 * @param[in] bufferIndex to use
776 * @param[in] lastVSyncTime The last VSync time in milliseconds.
777 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
778 * @return true, if any properties were updated.
780 bool ProcessGestures(BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds);
783 * Perform animation updates
784 * @param[in] bufferIndex to use
785 * @param[in] elapsedSeconds time since last frame
786 * @return true if at least one animations is currently active or false otherwise
788 bool Animate(BufferIndex bufferIndex, float elapsedSeconds);
791 * Applies constraints to CustomObjects
792 * @param[out] postPropertyOwner property owners those have post constraint.
793 * @param[in] bufferIndex to use
795 void ConstrainCustomObjects(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
798 * Applies constraints to RenderTasks
799 * @param[out] postPropertyOwner property owners those have post constraint.
800 * @param[in] bufferIndex to use
802 void ConstrainRenderTasks(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
805 * Applies constraints to Shaders
806 * @param[out] postPropertyOwner property owners those have post constraint.
807 * @param[in] bufferIndex to use
809 void ConstrainShaders(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
812 * Perform property notification updates
813 * @param[in] bufferIndex to use
815 void ProcessPropertyNotifications(BufferIndex bufferIndex);
818 * Pass shader binaries queued here on to event thread.
820 void ForwardCompiledShadersToEventThread();
823 * Update node shaders, opacity, geometry etc.
824 * @param[out] postPropertyOwner property owners those have post constraint.
825 * @param[in] bufferIndex to use
827 void UpdateNodes(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
830 * initialize layer renderables
831 * @param[in] bufferIndex
833 void UpdateLayers(BufferIndex bufferIndex);
837 * @param[out] postPropertyOwner property owners those have post constraint.
838 * @param[in] bufferIndex to use
840 void UpdateRenderers(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
843 // needs to be direct member so that getter for event buffer can be inlined
844 SceneGraphBuffers mSceneGraphBuffers;
850 // Messages for UpdateManager
852 inline void InstallRootMessage(UpdateManager& manager, OwnerPointer<Layer>& root)
854 // Message has ownership of Layer while in transit from event -> update
855 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Layer>>;
857 // Reserve some memory inside the message queue
858 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
860 // Construct message in the message queue memory; note that delete should not be called on the return value
861 new(slot) LocalType(&manager, &UpdateManager::InstallRoot, root);
864 inline void UninstallRootMessage(UpdateManager& manager, const Layer* constRoot)
866 // Scene graph thread can destroy this object.
867 Layer* root = const_cast<Layer*>(constRoot);
869 using LocalType = MessageValue1<UpdateManager, Layer*>;
871 // Reserve some memory inside the message queue
872 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
874 // Construct message in the message queue memory; note that delete should not be called on the return value
875 new(slot) LocalType(&manager, &UpdateManager::UninstallRoot, root);
878 inline void AddNodeMessage(UpdateManager& manager, OwnerPointer<Node>& node)
880 // Message has ownership of Node while in transit from event -> update
881 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Node>>;
883 // Reserve some memory inside the message queue
884 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
886 // Construct message in the message queue memory; note that delete should not be called on the return value
887 new(slot) LocalType(&manager, &UpdateManager::AddNode, node);
890 inline void ConnectNodeMessage(UpdateManager& manager, const Node& constParent, const Node& constChild)
892 // Update thread can edit the object
893 Node& parent = const_cast<Node&>(constParent);
894 Node& child = const_cast<Node&>(constChild);
896 using LocalType = MessageValue2<UpdateManager, Node*, Node*>;
898 // Reserve some memory inside the message queue
899 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
901 // Construct message in the message queue memory; note that delete should not be called on the return value
902 new(slot) LocalType(&manager, &UpdateManager::ConnectNode, &parent, &child);
905 inline void DisconnectNodeMessage(UpdateManager& manager, const Node& constNode)
907 // Scene graph thread can modify this object.
908 Node& node = const_cast<Node&>(constNode);
910 using LocalType = MessageValue1<UpdateManager, Node*>;
912 // Reserve some memory inside the message queue
913 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
915 // Construct message in the message queue memory; note that delete should not be called on the return value
916 new(slot) LocalType(&manager, &UpdateManager::DisconnectNode, &node);
919 inline void DestroyNodeMessage(UpdateManager& manager, const Node& constNode)
921 // Scene graph thread can destroy this object.
922 Node& node = const_cast<Node&>(constNode);
924 using LocalType = MessageValue1<UpdateManager, Node*>;
926 // Reserve some memory inside the message queue
927 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
929 // Construct message in the message queue memory; note that delete should not be called on the return value
930 new(slot) LocalType(&manager, &UpdateManager::DestroyNode, &node);
933 inline void AddObjectMessage(UpdateManager& manager, OwnerPointer<PropertyOwner>& object)
935 // Message has ownership of object while in transit from event -> update
936 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyOwner>>;
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::AddObject, object);
945 inline void RemoveObjectMessage(UpdateManager& manager, const PropertyOwner* object)
947 using LocalType = MessageValue1<UpdateManager, PropertyOwner*>;
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::RemoveObject, const_cast<PropertyOwner*>(object));
956 inline void AddAnimationMessage(UpdateManager& manager, OwnerPointer<SceneGraph::Animation>& animation)
958 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Animation>>;
960 // Reserve some memory inside the message queue
961 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
963 // Construct message in the message queue memory; note that delete should not be called on the return value
964 new(slot) LocalType(&manager, &UpdateManager::AddAnimation, animation);
967 inline void StopAnimationMessage(UpdateManager& manager, const Animation& constAnimation)
969 // The scene-graph thread owns this object so it can safely edit it.
970 Animation& animation = const_cast<Animation&>(constAnimation);
972 using LocalType = MessageValue1<UpdateManager, Animation*>;
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::StopAnimation, &animation);
981 inline void RemoveAnimationMessage(UpdateManager& manager, const Animation& constAnimation)
983 // The scene-graph thread owns this object so it can safely edit it.
984 Animation& animation = const_cast<Animation&>(constAnimation);
986 using LocalType = MessageValue1<UpdateManager, Animation*>;
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::RemoveAnimation, &animation);
995 inline void AddRenderTaskListMessage(UpdateManager& manager, OwnerPointer<SceneGraph::RenderTaskList>& taskList)
997 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::RenderTaskList>>;
999 // Reserve some memory inside the message queue
1000 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1002 // Construct message in the message queue memory; note that delete should not be called on the return value
1003 new(slot) LocalType(&manager, &UpdateManager::AddRenderTaskList, taskList);
1006 inline void RemoveRenderTaskListMessage(UpdateManager& manager, const RenderTaskList& constTaskList)
1008 // The scene-graph thread owns this object so it can safely edit it.
1009 RenderTaskList& taskList = const_cast<RenderTaskList&>(constTaskList);
1011 using LocalType = MessageValue1<UpdateManager, RenderTaskList*>;
1013 // Reserve some memory inside the message queue
1014 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1016 // Construct message in the message queue memory; note that delete should not be called on the return value
1017 new(slot) LocalType(&manager, &UpdateManager::RemoveRenderTaskList, &taskList);
1020 inline void AddSceneMessage(UpdateManager& manager, OwnerPointer<SceneGraph::Scene>& scene)
1022 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Scene>>;
1024 // Reserve some memory inside the message queue
1025 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1027 // Construct message in the message queue memory; note that delete should not be called on the return value
1028 new(slot) LocalType(&manager, &UpdateManager::AddScene, scene);
1031 inline void RemoveSceneMessage(UpdateManager& manager, const SceneGraph::Scene& constScene)
1033 // The scene-graph thread owns this object so it can safely edit it.
1034 Scene& scene = const_cast<Scene&>(constScene);
1036 using LocalType = MessageValue1<UpdateManager, Scene*>;
1038 // Reserve some memory inside the message queue
1039 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1041 // Construct message in the message queue memory; note that delete should not be called on the return value
1042 new(slot) LocalType(&manager, &UpdateManager::RemoveScene, &scene);
1045 inline void AddPropertyNotificationMessage(UpdateManager& manager, OwnerPointer<PropertyNotification>& propertyNotification)
1047 // Message has ownership of PropertyNotification while in transit from event -> update
1048 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyNotification>>;
1050 // Reserve some memory inside the message queue
1051 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1053 // Construct message in the message queue memory; note that delete should not be called on the return value
1054 new(slot) LocalType(&manager, &UpdateManager::AddPropertyNotification, propertyNotification);
1057 inline void RemovePropertyNotificationMessage(UpdateManager& manager, const PropertyNotification& constPropertyNotification)
1059 // The scene-graph thread owns this object so it can safely edit it.
1060 PropertyNotification& propertyNotification = const_cast<PropertyNotification&>(constPropertyNotification);
1062 using LocalType = MessageValue1<UpdateManager, PropertyNotification*>;
1064 // Reserve some memory inside the message queue
1065 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1067 // Construct message in the message queue memory; note that delete should not be called on the return value
1068 new(slot) LocalType(&manager, &UpdateManager::RemovePropertyNotification, &propertyNotification);
1071 inline void PropertyNotificationSetNotifyModeMessage(UpdateManager& manager,
1072 const PropertyNotification* constPropertyNotification,
1073 PropertyNotification::NotifyMode notifyMode)
1075 // The scene-graph thread owns this object so it can safely edit it.
1076 PropertyNotification* propertyNotification = const_cast<PropertyNotification*>(constPropertyNotification);
1078 using LocalType = MessageValue2<UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode>;
1080 // Reserve some memory inside the message queue
1081 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1083 // Construct message in the message queue memory; note that delete should not be called on the return value
1084 new(slot) LocalType(&manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode);
1087 // The render thread can safely change the Shader
1088 inline void AddShaderMessage(UpdateManager& manager, OwnerPointer<Shader>& shader)
1090 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Shader>>;
1092 // Reserve some memory inside the message queue
1093 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1095 // Construct message in the message queue memory; note that delete should not be called on the return value
1096 new(slot) LocalType(&manager, &UpdateManager::AddShader, shader);
1099 // The render thread can safely change the Shader
1100 inline void RemoveShaderMessage(UpdateManager& manager, const Shader* shader)
1102 using LocalType = MessageValue1<UpdateManager, Shader*>;
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::RemoveShader, const_cast<Shader*>(shader));
1111 inline void SurfaceReplacedMessage(UpdateManager& manager, const SceneGraph::Scene& constScene)
1113 // The scene-graph thread owns this object so it can safely edit it.
1114 Scene& scene = const_cast<Scene&>(constScene);
1116 using LocalType = MessageValue1<UpdateManager, Scene*>;
1118 // Reserve some memory inside the message queue
1119 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1121 // Construct message in the message queue memory; note that delete should not be called on the return value
1122 new(slot) LocalType(&manager, &UpdateManager::SurfaceReplaced, &scene);
1125 inline void KeepRenderingMessage(UpdateManager& manager, float durationSeconds)
1127 using LocalType = MessageValue1<UpdateManager, float>;
1129 // Reserve some memory inside the message queue
1130 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1132 // Construct message in the message queue memory; note that delete should not be called on the return value
1133 new(slot) LocalType(&manager, &UpdateManager::KeepRendering, durationSeconds);
1136 inline void SetRenderingBehaviorMessage(UpdateManager& manager, DevelStage::Rendering renderingBehavior)
1138 using LocalType = MessageValue1<UpdateManager, DevelStage::Rendering>;
1140 // Reserve some memory inside the message queue
1141 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1143 // Construct message in the message queue memory; note that delete should not be called on the return value
1144 new(slot) LocalType(&manager, &UpdateManager::SetRenderingBehavior, renderingBehavior);
1147 inline void RequestRenderingMessage(UpdateManager& manager)
1149 using LocalType = Message<UpdateManager>;
1151 // Reserve some memory inside the message queue
1152 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::RequestRendering);
1159 * Create a message for setting the depth of a layer
1160 * @param[in] manager The update manager
1161 * @param[in] layers list of layers
1162 * @param[in] rootLayer The rool layer
1164 inline void SetLayerDepthsMessage(UpdateManager& manager, const std::vector<Layer*>& layers, const Layer* rootLayer)
1166 using LocalType = MessageValue2<UpdateManager, std::vector<Layer*>, const Layer*>;
1168 // Reserve some memory inside the message queue
1169 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1171 // Construct message in the message queue memory; note that delete should not be called on the return value
1172 new(slot) LocalType(&manager, &UpdateManager::SetLayerDepths, layers, rootLayer);
1175 inline void AddRendererMessage(UpdateManager& manager, const RendererKey& rendererKey)
1177 using LocalType = MessageValue1<UpdateManager, RendererKey>;
1179 // Reserve some memory inside the message queue
1180 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1181 // Construct message in the message queue memory; note that delete should not be called on the return value
1182 new(slot) LocalType(&manager, &UpdateManager::AddRenderer, rendererKey);
1185 inline void RemoveRendererMessage(UpdateManager& manager, const RendererKey& rendererKey)
1187 using LocalType = MessageValue1<UpdateManager, RendererKey>;
1189 // Reserve some memory inside the message queue
1190 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1191 // Construct message in the message queue memory; note that delete should not be called on the return value
1192 new(slot) LocalType(&manager, &UpdateManager::RemoveRenderer, rendererKey);
1195 inline void AttachRendererMessage(UpdateManager& manager, const Node& node, const Renderer& renderer)
1197 using LocalType = MessageValue2<UpdateManager, Node*, Renderer*>;
1199 // Reserve some memory inside the message queue
1200 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1201 // Construct message in the message queue memory; note that delete should not be called on the return value
1202 new(slot) LocalType(&manager, &UpdateManager::AttachRenderer, const_cast<Node*>(&node), const_cast<Renderer*>(&renderer));
1205 // The render thread can safely change the Shader
1206 inline void AddTextureSetMessage(UpdateManager& manager, OwnerPointer<TextureSet>& textureSet)
1208 using LocalType = MessageValue1<UpdateManager, OwnerPointer<TextureSet>>;
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::AddTextureSet, textureSet);
1217 // The render thread can safely change the Shader
1218 inline void RemoveTextureSetMessage(UpdateManager& manager, TextureSet& textureSet)
1220 using LocalType = MessageValue1<UpdateManager, TextureSet*>;
1222 // Reserve some memory inside the message queue
1223 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1225 // Construct message in the message queue memory; note that delete should not be called on the return value
1226 new(slot) LocalType(&manager, &UpdateManager::RemoveTextureSet, &textureSet);
1229 inline void AddSamplerMessage(UpdateManager& manager, OwnerPointer<Render::Sampler>& sampler)
1231 // Message has ownership of Sampler while in transit from event -> update
1232 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Sampler>>;
1234 // Reserve some memory inside the message queue
1235 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1237 // Construct message in the message queue memory; note that delete should not be called on the return value
1238 new(slot) LocalType(&manager, &UpdateManager::AddSampler, sampler);
1241 inline void RemoveSamplerMessage(UpdateManager& manager, Render::Sampler& sampler)
1243 using LocalType = MessageValue1<UpdateManager, Render::Sampler*>;
1245 // Reserve some memory inside the message queue
1246 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1248 // Construct message in the message queue memory; note that delete should not be called on the return value
1249 new(slot) LocalType(&manager, &UpdateManager::RemoveSampler, &sampler);
1252 inline void SetFilterModeMessage(UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode)
1254 using LocalType = MessageValue3<UpdateManager, Render::Sampler*, uint32_t, uint32_t>;
1256 // Reserve some memory inside the message queue
1257 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1259 // Construct message in the message queue memory; note that delete should not be called on the return value
1260 new(slot) LocalType(&manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode);
1263 inline void SetWrapModeMessage(UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode)
1265 using LocalType = MessageValue4<UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t>;
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::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode);
1274 inline void AddVertexBuffer(UpdateManager& manager, OwnerPointer<Render::VertexBuffer>& vertexBuffer)
1276 // Message has ownership of vertexBuffer while in transit from event -> update
1277 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::VertexBuffer>>;
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::AddVertexBuffer, vertexBuffer);
1286 inline void RemoveVertexBuffer(UpdateManager& manager, Render::VertexBuffer& vertexBuffer)
1288 using LocalType = MessageValue1<UpdateManager, Render::VertexBuffer*>;
1290 // Reserve some memory inside the message queue
1291 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1293 // Construct message in the message queue memory; note that delete should not be called on the return value
1294 new(slot) LocalType(&manager, &UpdateManager::RemoveVertexBuffer, &vertexBuffer);
1297 inline void SetVertexBufferFormat(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format)
1299 // Message has ownership of VertexBuffer::Format while in transit from event -> update
1300 using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, OwnerPointer<Render::VertexBuffer::Format>>;
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::SetVertexBufferFormat, &vertexBuffer, format);
1309 inline void SetVertexBufferData(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer<Vector<uint8_t>>& data, uint32_t size)
1311 // Message has ownership of VertexBuffer data while in transit from event -> update
1312 using LocalType = MessageValue3<UpdateManager, Render::VertexBuffer*, OwnerPointer<Vector<uint8_t>>, uint32_t>;
1314 // Reserve some memory inside the message queue
1315 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1317 // Construct message in the message queue memory; note that delete should not be called on the return value
1318 new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferData, &vertexBuffer, data, size);
1321 inline void SetVertexBufferDivisorMessage(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, uint32_t divisor)
1323 using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, uint32_t>;
1324 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1325 new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferDivisor, &vertexBuffer, divisor);
1328 inline void SetVertexBufferUpdateCallbackMessage(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, Dali::VertexBufferUpdateCallback* callback)
1330 // Message has ownership of VertexBuffer data while in transit from event -> update
1331 using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, Dali::VertexBufferUpdateCallback*>;
1333 // Reserve some memory inside the message queue
1334 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1336 // Construct message in the message queue memory; note that delete should not be called on the return value
1337 new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferUpdateCallback, &vertexBuffer, callback);
1340 inline void AddGeometry(UpdateManager& manager, OwnerPointer<Render::Geometry>& geometry)
1342 // Message has ownership of Geometry while in transit from event -> update
1343 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Geometry>>;
1345 // Reserve some memory inside the message queue
1346 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1348 // Construct message in the message queue memory; note that delete should not be called on the return value
1349 new(slot) LocalType(&manager, &UpdateManager::AddGeometry, geometry);
1352 inline void RemoveGeometry(UpdateManager& manager, Render::Geometry& geometry)
1354 using LocalType = MessageValue1<UpdateManager, Render::Geometry*>;
1356 // Reserve some memory inside the message queue
1357 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1359 // Construct message in the message queue memory; note that delete should not be called on the return value
1360 new(slot) LocalType(&manager, &UpdateManager::RemoveGeometry, &geometry);
1363 inline void AttachVertexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer)
1365 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
1367 // Reserve some memory inside the message queue
1368 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1370 // Construct message in the message queue memory; note that delete should not be called on the return value
1371 new(slot) LocalType(&manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer));
1374 inline void RemoveVertexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer)
1376 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
1378 // Reserve some memory inside the message queue
1379 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1381 // Construct message in the message queue memory; note that delete should not be called on the return value
1382 new(slot) LocalType(&manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer));
1385 // Custom message type for SetIndexBuffer() used to move data with Vector::Swap()
1386 template<typename T, typename IndexContainerType>
1387 class IndexBufferMessage : public MessageBase
1391 * Constructor which does a Vector::Swap()
1393 IndexBufferMessage(T* manager, Render::Geometry* geometry, IndexContainerType& indices)
1396 mRenderGeometry(geometry)
1398 mIndices.Swap(indices);
1402 * Virtual destructor
1404 ~IndexBufferMessage() override = default;
1407 * @copydoc MessageBase::Process
1409 void Process(BufferIndex /*bufferIndex*/) override
1411 DALI_ASSERT_DEBUG(mManager && "Message does not have an object");
1412 mManager->SetIndexBuffer(mRenderGeometry, mIndices);
1417 Render::Geometry* mRenderGeometry;
1418 IndexContainerType mIndices;
1421 inline void SetIndexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, Render::Geometry::Uint16ContainerType& indices)
1423 using LocalType = IndexBufferMessage<UpdateManager, Render::Geometry::Uint16ContainerType>;
1425 // Reserve some memory inside the message queue
1426 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1428 // Construct message in the message queue memory; note that delete should not be called on the return value
1429 new(slot) LocalType(&manager, &geometry, indices);
1432 inline void SetIndexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, Render::Geometry::Uint32ContainerType& indices)
1434 using LocalType = IndexBufferMessage<UpdateManager, Render::Geometry::Uint32ContainerType>;
1436 // Reserve some memory inside the message queue
1437 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1439 // Construct message in the message queue memory; note that delete should not be called on the return value
1440 new(slot) LocalType(&manager, &geometry, indices);
1443 inline void SetGeometryTypeMessage(UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType)
1445 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, uint32_t>;
1447 // Reserve some memory inside the message queue
1448 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1450 // Construct message in the message queue memory; note that delete should not be called on the return value
1451 new(slot) LocalType(&manager, &UpdateManager::SetGeometryType, &geometry, geometryType);
1454 inline void AddTextureMessage(UpdateManager& manager, const Render::TextureKey& texture)
1456 using LocalType = MessageValue1<UpdateManager, Render::TextureKey>;
1458 // Reserve some memory inside the message queue
1459 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1461 // Construct message in the message queue memory; note that delete should not be called on the return value
1462 new(slot) LocalType(&manager, &UpdateManager::AddTexture, texture);
1465 inline void RemoveTextureMessage(UpdateManager& manager, const Render::TextureKey& texture)
1467 using LocalType = MessageValue1<UpdateManager, Render::TextureKey>;
1469 // Reserve some memory inside the message queue
1470 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1472 // Construct message in the message queue memory; note that delete should not be called on the return value
1473 new(slot) LocalType(&manager, &UpdateManager::RemoveTexture, texture);
1476 inline void UploadTextureMessage(UpdateManager& manager, Render::TextureKey texture, PixelDataPtr pixelData, const Graphics::UploadParams& params)
1478 using LocalType = MessageValue3<UpdateManager, Render::TextureKey, PixelDataPtr, Graphics::UploadParams>;
1480 // Reserve some memory inside the message queue
1481 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1483 // Construct message in the message queue memory; note that delete should not be called on the return value
1484 new(slot) LocalType(&manager, &UpdateManager::UploadTexture, texture, pixelData, params);
1487 inline void GenerateMipmapsMessage(UpdateManager& manager, Render::TextureKey texture)
1489 using LocalType = MessageValue1<UpdateManager, Render::TextureKey>;
1491 // Reserve some memory inside the message queue
1492 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1494 // Construct message in the message queue memory; note that delete should not be called on the return value
1495 new(slot) LocalType(&manager, &UpdateManager::GenerateMipmaps, texture);
1498 inline void SetTextureSizeMessage(UpdateManager& manager, Render::TextureKey texture, const Dali::ImageDimensions& size)
1500 using LocalType = MessageValue2<UpdateManager, Render::TextureKey, Dali::ImageDimensions>;
1502 // Reserve some memory inside the message queue
1503 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1505 // Construct message in the message queue memory; note that delete should not be called on the return value
1506 new(slot) LocalType(&manager, &UpdateManager::SetTextureSize, texture, size);
1509 inline void SetTextureFormatMessage(UpdateManager& manager, Render::TextureKey texture, Dali::Pixel::Format pixelFormat)
1511 using LocalType = MessageValue2<UpdateManager, Render::TextureKey, Dali::Pixel::Format>;
1513 // Reserve some memory inside the message queue
1514 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1516 // Construct message in the message queue memory; note that delete should not be called on the return value
1517 new(slot) LocalType(&manager, &UpdateManager::SetTextureFormat, texture, pixelFormat);
1520 inline void AddFrameBuffer(UpdateManager& manager, OwnerPointer<Render::FrameBuffer>& frameBuffer)
1522 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::FrameBuffer>>;
1524 // Reserve some memory inside the message queue
1525 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1527 // Construct message in the message queue memory; note that delete should not be called on the return value
1528 new(slot) LocalType(&manager, &UpdateManager::AddFrameBuffer, frameBuffer);
1531 inline void RemoveFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer)
1533 using LocalType = MessageValue1<UpdateManager, Render::FrameBuffer*>;
1535 // Reserve some memory inside the message queue
1536 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1538 // Construct message in the message queue memory; note that delete should not be called on the return value
1539 new(slot) LocalType(&manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer);
1542 inline void AttachColorTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer)
1544 using LocalType = MessageValue4<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t>;
1546 // Reserve some memory inside the message queue
1547 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1549 // Construct message in the message queue memory; note that delete should not be called on the return value
1550 new(slot) LocalType(&manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer);
1553 inline void AttachDepthTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
1555 using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
1557 // Reserve some memory inside the message queue
1558 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1560 // Construct message in the message queue memory; note that delete should not be called on the return value
1561 new(slot) LocalType(&manager, &UpdateManager::AttachDepthTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel);
1564 inline void AttachDepthStencilTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
1566 using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
1568 // Reserve some memory inside the message queue
1569 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1571 // Construct message in the message queue memory; note that delete should not be called on the return value
1572 new(slot) LocalType(&manager, &UpdateManager::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel);
1575 inline void SetMultiSamplingLevelToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, uint8_t multiSamplingLevel)
1577 using LocalType = MessageValue2<UpdateManager, Render::FrameBuffer*, uint8_t>;
1579 // Reserve some memory inside the message queue
1580 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1582 // Construct message in the message queue memory; note that delete should not be called on the return value
1583 new(slot) LocalType(&manager, &UpdateManager::SetMultiSamplingLevelToFrameBuffer, &frameBuffer, multiSamplingLevel);
1586 inline void SetDepthIndicesMessage(UpdateManager& manager, OwnerPointer<NodeDepths>& nodeDepths)
1588 using LocalType = MessageValue1<UpdateManager, OwnerPointer<NodeDepths>>;
1590 // Reserve some memory inside the message queue
1591 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1593 // Construct message in the message queue memory; note that delete should not be called on the return value
1594 new(slot) LocalType(&manager, &UpdateManager::SetDepthIndices, nodeDepths);
1597 inline void AddResetterMessage(UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter)
1599 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyResetterBase>>;
1601 // Reserve some memory inside the message queue
1602 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1604 // Construct message in the message queue memory; note that delete should not be called on the return value
1605 new(slot) LocalType(&manager, &UpdateManager::AddPropertyResetter, resetter);
1608 inline void AddFrameCallbackMessage(UpdateManager& manager, OwnerPointer<FrameCallback>& frameCallback, const Node& rootNode)
1610 using LocalType = MessageValue2<UpdateManager, OwnerPointer<FrameCallback>, const Node*>;
1612 // Reserve some memory inside the message queue
1613 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1615 // Construct message in the message queue memory; note that delete should not be called on the return value
1616 new(slot) LocalType(&manager, &UpdateManager::AddFrameCallback, frameCallback, &rootNode);
1619 inline void AddGlobalFrameCallbackMessage(UpdateManager& manager, OwnerPointer<FrameCallback>& frameCallback)
1621 using LocalType = MessageValue2<UpdateManager, OwnerPointer<FrameCallback>, const Node*>;
1623 // Reserve some memory inside the message queue
1624 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1626 // Construct message in the message queue memory; note that delete should not be called on the return value
1627 new(slot) LocalType(&manager, &UpdateManager::AddFrameCallback, frameCallback, nullptr);
1630 inline void RemoveFrameCallbackMessage(UpdateManager& manager, FrameCallbackInterface& frameCallback)
1632 using LocalType = MessageValue1<UpdateManager, FrameCallbackInterface*>;
1634 // Reserve some memory inside the message queue
1635 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1637 // Construct message in the message queue memory; note that delete should not be called on the return value
1638 new(slot) LocalType(&manager, &UpdateManager::RemoveFrameCallback, &frameCallback);
1641 inline void NotifyFrameCallbackMessage(UpdateManager& manager, FrameCallbackInterface* frameCallback, Dali::UpdateProxy::NotifySyncPoint syncPoint)
1643 using LocalType = MessageValue2<UpdateManager, FrameCallbackInterface*, Dali::UpdateProxy::NotifySyncPoint>;
1644 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1645 new(slot) LocalType(&manager, &UpdateManager::NotifyFrameCallback, frameCallback, syncPoint);
1648 } // namespace SceneGraph
1650 } // namespace Internal
1654 #endif // DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H