1 #ifndef DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
2 #define DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
5 * Copyright (c) 2023 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 >
58 class FrameCallbackInterface;
62 class RenderController;
64 } // namespace Integration
68 class PropertyNotifier;
69 class NotificationManager;
70 class CompleteNotificationInterface;
78 // value types used by messages
80 struct ParameterType<PropertyNotification::NotifyMode>
81 : public BasicType<PropertyNotification::NotifyMode>
90 class RenderTaskProcessor;
95 * UpdateManager maintains a scene graph i.e. a tree of nodes as well as
96 * other scene graph property owning objects.
97 * It controls the Update traversal, in which nodes are repositioned/animated,
98 * and organizes the the culling and rendering of the scene.
99 * It also maintains the lifecycle of nodes and other property owners that are
100 * disconnected from the scene graph.
102 class UpdateManager : public ShaderSaver, public ResetterManager
106 * Construct a new UpdateManager.
107 * @param[in] notificationManager This should be notified when animations have finished.
108 * @param[in] animationPlaylist The CompleteNotificationInterface that handles the animations
109 * @param[in] propertyNotifier The PropertyNotifier
110 * @param[in] controller After messages are flushed, we request a render from the RenderController.
111 * @param[in] renderManager This is responsible for rendering the results of each "update".
112 * @param[in] renderQueue Used to queue messages for the next render.
113 * @param[in] renderTaskProcessor Handles RenderTasks and RenderInstrucitons.
115 UpdateManager(NotificationManager& notificationManager,
116 CompleteNotificationInterface& animationPlaylist,
117 PropertyNotifier& propertyNotifier,
118 Integration::RenderController& controller,
119 RenderManager& renderManager,
120 RenderQueue& renderQueue,
121 RenderTaskProcessor& renderTaskProcessor);
126 ~UpdateManager() override;
128 // Node connection methods
131 * Installs a new layer as the root node.
132 * @pre The layer is of derived Node type Layer.
133 * @pre The layer does not have a parent.
134 * @param[in] layer The new root node.
135 * @post The node is owned by UpdateManager.
137 void InstallRoot(OwnerPointer<Layer>& layer);
140 * Uninstalls the root node.
141 * @pre The layer is of derived Node type Layer.
142 * @pre The layer does not have a parent.
143 * @param[in] layer The root node.
144 * @post The node is owned by UpdateManager.
146 void UninstallRoot(Layer* layer);
149 * Add a Node; UpdateManager takes ownership.
150 * @pre The node does not have a parent.
151 * @note even though nodes are pool allocated, they also contain other heap allocated data, thus using OwnerPointer when transferring the data
152 * @param[in] node The node to add.
154 void AddNode(OwnerPointer<Node>& node);
157 * Connect a Node to the scene-graph.
158 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
159 * @pre The node does not already have a parent.
160 * @param[in] parent The new parent node.
162 void ConnectNode(Node* parent, Node* node);
165 * Disconnect a Node from the scene-graph.
166 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
167 * @pre The node has a parent.
168 * @param[in] node The node to disconnect.
170 void DisconnectNode(Node* node);
173 * Destroy a Node owned by UpdateManager.
174 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
175 * In the following update, the previously queued Nodes may be deleted.
176 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
177 * @param[in] node The node to destroy.
179 void DestroyNode(Node* node);
182 * Add a newly created object.
183 * @param[in] object The object to add.
184 * @post The object is owned by UpdateManager.
186 void AddObject(OwnerPointer<PropertyOwner>& object);
190 * @param[in] object The object to remove.
192 void RemoveObject(PropertyOwner* object);
195 * Add a newly created render task list.
196 * @param[in] taskList The render task list to add.
197 * @post The render task list is owned by UpdateManager.
199 void AddRenderTaskList(OwnerPointer<RenderTaskList>& taskList);
202 * Remove a render task list.
203 * @param[in] taskList The render task list to remove.
205 void RemoveRenderTaskList(RenderTaskList* taskList);
208 * Add a newly created scene.
209 * @param[in] scene The scene to add.
210 * @post The scene is owned by UpdateManager.
212 void AddScene(OwnerPointer<Scene>& scene);
216 * @param[in] scene The scene to remove.
218 void RemoveScene(Scene* scene);
223 * Add a newly created animation.
224 * @param[in] animation The animation to add.
225 * @post The animation is owned by UpdateManager.
227 void AddAnimation(OwnerPointer<SceneGraph::Animation>& animation);
231 * @param[in] animation The animation to stop.
233 void StopAnimation(Animation* animation);
236 * Remove an animation.
237 * @param[in] animation The animation to remove.
239 void RemoveAnimation(Animation* animation);
242 * Query whether any animations are currently running.
243 * @return True if any animations are running.
245 bool IsAnimationRunning() const;
250 * @copydoc Dali::Internal::SceneGraph::ResetterManager::AddPropertyResetter()
252 void AddPropertyResetter(OwnerPointer<PropertyResetterBase>& propertyResetter) override;
255 * @copydoc Dali::Internal::SceneGraph::ResetterManager::AddNodeResetter()
257 void AddNodeResetter(const Node& node) override;
260 * @copydoc Dali::Internal::SceneGraph::ResetterManager::AddRendererResetter()
262 void AddRendererResetter(const Renderer& renderer) override;
264 // Property Notification
267 * Add a newly created property notification
268 * @param[in] propertyNotification The notification to add
269 * @post The propertyNotification is owned by UpdateManager.
271 void AddPropertyNotification(OwnerPointer<PropertyNotification>& propertyNotification);
274 * Remove a property notification
275 * @param[in] propertyNotification The notification to remove
277 void RemovePropertyNotification(PropertyNotification* propertyNotification);
280 * Set Notify state for PropertyNotification
281 * @param[in] propertyNotification The notification to remove
282 * @param[in] notifyMode The notification mode.
284 void PropertyNotificationSetNotify(PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode);
289 * Add a newly created shader.
290 * @param[in] shader The shader to add.
291 * @post The shader is owned by the UpdateManager.
293 void AddShader(OwnerPointer<Shader>& shader);
297 * @pre The shader has been added to the UpdateManager.
298 * @param[in] shader The shader to remove.
299 * @post The shader is destroyed.
301 void RemoveShader(Shader* shader);
304 * Set the shader data for a Shader object
305 * @param[in] shader The shader to modify
306 * @param[in] shaderData Source code, hash over source, and optional compiled binary for the shader program
308 void SetShaderData(Shader* shader, Internal::ShaderDataPtr shaderData);
311 * @brief Accept compiled shaders passed back on render thread for saving.
312 * @param[in] shaderData Source code, hash over source, and corresponding compiled binary to be saved.
314 void SaveBinary(Internal::ShaderDataPtr shaderData) override;
317 * @brief Set the destination for compiled shader binaries to be passed on to.
318 * The dispatcher passed in will be called from the update thread.
319 * @param[in] upstream A sink for ShaderDatas to be passed into.
321 void SetShaderSaver(ShaderSaver& upstream);
326 * Add a new renderer to scene
327 * @param renderer to add
329 void AddRenderer(const RendererKey& renderer);
332 * Remove a renderer from scene
333 * @param renderer to remove
335 void RemoveRenderer(const RendererKey& renderer);
338 * Attach a renderer to node
339 * @param renderer to attach
341 void AttachRenderer(Node* node, Renderer* renderer);
346 * Set the pan gesture processor.
347 * Pan Gesture processor lives for the lifetime of UpdateManager
348 * @param[in] gesture The gesture processor.
349 * @post The gestureProcessor is owned by the UpdateManager.
351 void SetPanGestureProcessor(PanGesture* gestureProcessor);
356 * Add a newly created TextureSet.
357 * @param[in] textureSet The texture set to add.
358 * @post The TextureSet is owned by the UpdateManager.
360 void AddTextureSet(OwnerPointer<TextureSet>& textureSet);
363 * Remove a TextureSet.
364 * @pre The TextureSet has been added to the UpdateManager.
365 * @param[in] textureSet The TextureSet to remove.
366 * @post The TextureSet is destroyed.
368 void RemoveTextureSet(TextureSet* textureSet);
373 * Get the scene graph side list of RenderTasks.
374 * @param[in] systemLevel True if using the system-level overlay.
375 * @return The list of render tasks
377 RenderTaskList* GetRenderTaskList(bool systemLevel);
379 // Message queue handling
382 * Reserve space for another message in the queue; this must then be initialized by the caller.
383 * The message will be read from the update-thread after the next FlushMessages is called.
384 * @post Calling this method may invalidate any previously returned slots.
385 * @param[in] size The message size with respect to the size of type "char".
386 * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
387 * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
388 * @return A pointer to the first char allocated for the message.
390 uint32_t* ReserveMessageSlot(uint32_t size, bool updateScene = true);
393 * @return the current event-buffer index.
395 BufferIndex GetEventBufferIndex() const
397 // inlined as its called often from event thread
398 return mSceneGraphBuffers.GetEventBufferIndex();
402 * Called by the event-thread to signal that FlushQueue will be called
403 * e.g. when it has finished event processing.
405 void EventProcessingStarted();
408 * Flush the set of messages, which were previously stored with QueueMessage().
409 * Calls to this thread-safe method should be minimized, to avoid thread blocking.
411 * @return True if there are messages to process.
416 * Add a new sampler to RenderManager
417 * @param[in] sampler The sampler to add
418 * @post Sends a message to RenderManager to add the sampler.
419 * The sampler will be owned by RenderManager
421 void AddSampler(OwnerPointer<Render::Sampler>& sampler);
424 * Removes an existing sampler from RenderManager
425 * @param[in] sampler The sampler to remove
426 * @post The sampler will be destroyed in the render thread
428 void RemoveSampler(Render::Sampler* sampler);
431 * Sets the filter modes for an existing sampler
432 * @param[in] sampler The sampler
433 * @param[in] minFilterMode The filter to use under minification
434 * @param[in] magFilterMode The filter to use under magnification
436 void SetFilterMode(Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode);
439 * Sets the wrap mode for an existing sampler
440 * @param[in] sampler The sampler
441 * @param[in] rWrapMode Wrapping mode in z direction
442 * @param[in] sWrapMode Wrapping mode in x direction
443 * @param[in] tWrapMode Wrapping mode in y direction
445 void SetWrapMode(Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode);
448 * Add a new property buffer to RenderManager
449 * @param[in] propertryBuffer The property buffer to add
450 * @post Sends a message to RenderManager to add the property buffer.
451 * The property buffer will be owned by RenderManager
453 void AddVertexBuffer(OwnerPointer<Render::VertexBuffer>& propertryBuffer);
456 * Removes an existing VertexBuffer from RenderManager
457 * @param[in] propertryBuffer The property buffer to remove
458 * @post The property buffer will be destroyed in the render thread
460 void RemoveVertexBuffer(Render::VertexBuffer* propertryBuffer);
463 * Sets the format of an existing property buffer
464 * @param[in] vertexBuffer The property buffer.
465 * @param[in] format The new format of the buffer
466 * @post Sends a message to RenderManager to set the new format to the property buffer.
468 void SetVertexBufferFormat(Render::VertexBuffer* vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format);
471 * Sets the data of an existing property buffer
472 * @param[in] vertexBuffer The property buffer.
473 * @param[in] data The new data of the buffer
474 * @param[in] size The new size of the buffer
475 * @post Sends a message to RenderManager to set the new data to the property buffer.
477 void SetVertexBufferData(Render::VertexBuffer* vertexBuffer, OwnerPointer<Vector<uint8_t>>& data, uint32_t size);
480 * Sets the divisor of a vertex buffer. This is used by the GPU to provide
482 * @param[in] vertexBuffer The property buffer.
483 * @param[in] divisor The instance divisor. 0 to turn instancing off.
485 void SetVertexBufferDivisor(Render::VertexBuffer* vertexBuffer, uint32_t divisor);
487 * Sets vertex buffer update callback
488 * @param[in] vertexBuffer
489 * @param[in] callback
491 void SetVertexBufferUpdateCallback(Render::VertexBuffer* vertexBuffer, Dali::VertexBufferUpdateCallback* callback);
494 * Adds a geometry to the RenderManager
495 * @param[in] geometry The geometry to add
496 * @post Sends a message to RenderManager to add the Geometry
497 * The geometry will be owned by RenderManager
499 void AddGeometry(OwnerPointer<Render::Geometry>& geometry);
502 * Removes an existing Geometry from RenderManager
503 * @param[in] geometry The geometry to remove
504 * @post The geometry will be destroyed in the render thread
506 void RemoveGeometry(Render::Geometry* geometry);
509 * Sets the geometry type of an existing Geometry
510 * @param[in] geometry The geometry
511 * @param[in] geometryType The type of the geometry
513 void SetGeometryType(Render::Geometry* geometry, uint32_t geometryType);
516 * Sets the index buffer to be used by a geometry
517 * @param[in] geometry The geometry
518 * @param[in] indices A vector containing the indices for the geometry
520 void SetIndexBuffer(Render::Geometry* geometry, Render::Geometry::Uint16ContainerType& indices);
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::Uint32ContainerType& indices);
530 * Adds a vertex buffer to a geometry
531 * @param[in] geometry The geometry
532 * @param[in] vertexBuffer The property buffer
534 void AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
537 * Removes a vertex buffer from a geometry
538 * @param[in] geometry The geometry
539 * @param[in] vertexBuffer The property buffer
541 void RemoveVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
544 * Adds a texture to the render manager
545 * @param[in] texture The texture to add
546 * The texture will be owned by RenderManager
548 void AddTexture(const Render::TextureKey& texture);
551 * Removes a texture from the render manager
552 * @param[in] texture The texture to remove
553 * @post The texture will be destroyed in the render thread
555 void RemoveTexture(const Render::TextureKey& texture);
558 * Uploads data to a texture owned by the RenderManager
559 * @param[in] texture The texture
560 * @param[in] pixelData The pixel data object
561 * @param[in] params The parameters for the upload
563 void UploadTexture(const Render::TextureKey& texture, PixelDataPtr pixelData, const Texture::UploadParams& params);
566 * Generates mipmaps for a texture owned by the RenderManager
567 * @param[in] texture The texture
569 void GenerateMipmaps(const Render::TextureKey& texture);
572 * Adds a framebuffer to the render manager
573 * @param[in] frameBuffer The framebuffer to add
574 * The framebuffer will be owned by RenderManager
576 void AddFrameBuffer(OwnerPointer<Render::FrameBuffer>& frameBuffer);
579 * Removes a FrameBuffer from the render manager
580 * @param[in] frameBuffer The FrameBuffer to remove
581 * @post The FrameBuffer will be destroyed in the render thread
583 void RemoveFrameBuffer(Render::FrameBuffer* frameBuffer);
586 * Attach a texture as color output to an existing FrameBuffer
587 * @param[in] frameBuffer The FrameBuffer
588 * @param[in] texture The texture that will be used as output when rendering
589 * @param[in] mipmapLevel The mipmap of the texture to be attached
590 * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
592 void AttachColorTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face);
595 * Attach a texture as depth output to an existing FrameBuffer
596 * @param[in] frameBuffer The FrameBuffer
597 * @param[in] texture The texture that will be used as output when rendering
598 * @param[in] mipmapLevel The mipmap of the texture to be attached
600 void AttachDepthTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
603 * Attach a texture as depth/stencil output to an existing FrameBuffer
604 * @param[in] frameBuffer The FrameBuffer
605 * @param[in] texture The texture that will be used as output when rendering
606 * @param[in] mipmapLevel The mipmap of the texture to be attached
608 void AttachDepthStencilTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
611 * Set a multisampling level value as texture output to the existing FrameBuffer
612 * @param[in] frameBuffer The FrameBuffer
613 * @param[in] multiSamplingLevel The level of multisampling
615 void SetMultiSamplingLevelToFrameBuffer(Render::FrameBuffer* frameBuffer, uint8_t multiSamplingLevel);
618 * This is called when the surface of the scene has been replaced.
619 * @param[in] scene The scene.
621 void SurfaceReplaced(Scene* scene);
625 * Performs an Update traversal on the scene-graph.
626 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
627 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
628 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
629 * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled.
630 * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
631 * @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
632 * @return True if further updates are required e.g. during animations.
634 uint32_t Update(float elapsedSeconds,
635 uint32_t lastVSyncTimeMilliseconds,
636 uint32_t nextVSyncTimeMilliseconds,
637 bool renderToFboEnabled,
638 bool isRenderingToFbo,
642 * This is called after rendering all the scenes in the next frame.
647 * @copydoc Dali::Stage::KeepRendering()
649 void KeepRendering(float durationSeconds);
652 * @copydoc Dali::DevelStage::SetRenderingBehavior()
654 void SetRenderingBehavior(DevelStage::Rendering renderingBehavior);
657 * Request to render the current frame
658 * @note This is a temporary workaround (to be removed in the future) to request the rendering of
659 * the current frame if the color or visibility of any actor is updated. It MUST NOT be used
660 * for any other purposes.
662 void RequestRendering();
665 * Sets the depths of all layers.
666 * @param layers The layers in depth order.
667 * @param[in] rootLayer The root layer of the sorted layers.
669 void SetLayerDepths(const std::vector<Layer*>& layers, const Layer* rootLayer);
672 * Set the depth indices of all nodes (in LayerUI's)
673 * @param[in] nodeDepths A vector of nodes and associated depth indices
675 void SetDepthIndices(OwnerPointer<NodeDepths>& nodeDepths);
678 * Adds an implementation of the FrameCallbackInterface.
679 * @param[in] frameCallback An OwnerPointer to the SceneGraph FrameCallback object
680 * @param[in] rootNode A pointer to the root node to apply the FrameCallback to
682 void AddFrameCallback(OwnerPointer<FrameCallback>& frameCallback, const Node* rootNode);
685 * Removes the specified implementation of FrameCallbackInterface.
686 * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to remove.
688 void RemoveFrameCallback(FrameCallbackInterface* frameCallback);
691 * Get the update message queue capacity (mutex locked)
693 std::size_t GetUpdateMessageQueueCapacity() const;
696 * Get the render message queue capacity
698 std::size_t GetRenderMessageQueueCapacity() const;
701 * Get the render instruction capacity
703 std::size_t GetRenderInstructionCapacity() const;
707 UpdateManager(const UpdateManager&);
710 UpdateManager& operator=(const UpdateManager& rhs);
713 * Add a camera on scene
714 * @param[in] camera The camera to add
716 void AddCamera(Camera* camera);
719 * Remove a camera from scene
720 * @param[in] camera to remove
722 void RemoveCamera(Camera* camera);
725 * Helper to check whether the update-thread should keep going.
726 * @param[in] elapsedSeconds The time in seconds since the previous update.
727 * @return True if the update-thread should keep going.
729 uint32_t KeepUpdatingCheck(float elapsedSeconds) const;
732 * Helper to reset all Node properties
733 * @param[in] bufferIndex to use
735 void ResetProperties(BufferIndex bufferIndex);
738 * Perform gesture updates.
739 * @param[in] bufferIndex to use
740 * @param[in] lastVSyncTime The last VSync time in milliseconds.
741 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
742 * @return true, if any properties were updated.
744 bool ProcessGestures(BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds);
747 * Perform animation updates
748 * @param[in] bufferIndex to use
749 * @param[in] elapsedSeconds time since last frame
750 * @return true if at least one animations is currently active or false otherwise
752 bool Animate(BufferIndex bufferIndex, float elapsedSeconds);
755 * Applies constraints to CustomObjects
756 * @param[out] postPropertyOwner property owners those have post constraint.
757 * @param[in] bufferIndex to use
759 void ConstrainCustomObjects(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
762 * Applies constraints to RenderTasks
763 * @param[out] postPropertyOwner property owners those have post constraint.
764 * @param[in] bufferIndex to use
766 void ConstrainRenderTasks(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
769 * Applies constraints to Shaders
770 * @param[out] postPropertyOwner property owners those have post constraint.
771 * @param[in] bufferIndex to use
773 void ConstrainShaders(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
776 * Perform property notification updates
777 * @param[in] bufferIndex to use
779 void ProcessPropertyNotifications(BufferIndex bufferIndex);
782 * Pass shader binaries queued here on to event thread.
784 void ForwardCompiledShadersToEventThread();
787 * Update node shaders, opacity, geometry etc.
788 * @param[out] postPropertyOwner property owners those have post constraint.
789 * @param[in] bufferIndex to use
791 void UpdateNodes(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
794 * initialize layer renderables
795 * @param[in] bufferIndex
797 void UpdateLayers(BufferIndex bufferIndex);
801 * @param[out] postPropertyOwner property owners those have post constraint.
802 * @param[in] bufferIndex to use
804 void UpdateRenderers(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex);
807 // needs to be direct member so that getter for event buffer can be inlined
808 SceneGraphBuffers mSceneGraphBuffers;
814 // Messages for UpdateManager
816 inline void InstallRootMessage(UpdateManager& manager, OwnerPointer<Layer>& root)
818 // Message has ownership of Layer while in transit from event -> update
819 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Layer>>;
821 // Reserve some memory inside the message queue
822 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
824 // Construct message in the message queue memory; note that delete should not be called on the return value
825 new(slot) LocalType(&manager, &UpdateManager::InstallRoot, root);
828 inline void UninstallRootMessage(UpdateManager& manager, const Layer* constRoot)
830 // Scene graph thread can destroy this object.
831 Layer* root = const_cast<Layer*>(constRoot);
833 using LocalType = MessageValue1<UpdateManager, Layer*>;
835 // Reserve some memory inside the message queue
836 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
838 // Construct message in the message queue memory; note that delete should not be called on the return value
839 new(slot) LocalType(&manager, &UpdateManager::UninstallRoot, root);
842 inline void AddNodeMessage(UpdateManager& manager, OwnerPointer<Node>& node)
844 // Message has ownership of Node while in transit from event -> update
845 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Node>>;
847 // Reserve some memory inside the message queue
848 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
850 // Construct message in the message queue memory; note that delete should not be called on the return value
851 new(slot) LocalType(&manager, &UpdateManager::AddNode, node);
854 inline void ConnectNodeMessage(UpdateManager& manager, const Node& constParent, const Node& constChild)
856 // Update thread can edit the object
857 Node& parent = const_cast<Node&>(constParent);
858 Node& child = const_cast<Node&>(constChild);
860 using LocalType = MessageValue2<UpdateManager, Node*, Node*>;
862 // Reserve some memory inside the message queue
863 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
865 // Construct message in the message queue memory; note that delete should not be called on the return value
866 new(slot) LocalType(&manager, &UpdateManager::ConnectNode, &parent, &child);
869 inline void DisconnectNodeMessage(UpdateManager& manager, const Node& constNode)
871 // Scene graph thread can modify this object.
872 Node& node = const_cast<Node&>(constNode);
874 using LocalType = MessageValue1<UpdateManager, Node*>;
876 // Reserve some memory inside the message queue
877 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
879 // Construct message in the message queue memory; note that delete should not be called on the return value
880 new(slot) LocalType(&manager, &UpdateManager::DisconnectNode, &node);
883 inline void DestroyNodeMessage(UpdateManager& manager, const Node& constNode)
885 // Scene graph thread can destroy this object.
886 Node& node = const_cast<Node&>(constNode);
888 using LocalType = MessageValue1<UpdateManager, Node*>;
890 // Reserve some memory inside the message queue
891 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
893 // Construct message in the message queue memory; note that delete should not be called on the return value
894 new(slot) LocalType(&manager, &UpdateManager::DestroyNode, &node);
897 inline void AddObjectMessage(UpdateManager& manager, OwnerPointer<PropertyOwner>& object)
899 // Message has ownership of object while in transit from event -> update
900 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyOwner>>;
902 // Reserve some memory inside the message queue
903 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
905 // Construct message in the message queue memory; note that delete should not be called on the return value
906 new(slot) LocalType(&manager, &UpdateManager::AddObject, object);
909 inline void RemoveObjectMessage(UpdateManager& manager, const PropertyOwner* object)
911 using LocalType = MessageValue1<UpdateManager, PropertyOwner*>;
913 // Reserve some memory inside the message queue
914 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
916 // Construct message in the message queue memory; note that delete should not be called on the return value
917 new(slot) LocalType(&manager, &UpdateManager::RemoveObject, const_cast<PropertyOwner*>(object));
920 inline void AddAnimationMessage(UpdateManager& manager, OwnerPointer<SceneGraph::Animation>& animation)
922 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Animation>>;
924 // Reserve some memory inside the message queue
925 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
927 // Construct message in the message queue memory; note that delete should not be called on the return value
928 new(slot) LocalType(&manager, &UpdateManager::AddAnimation, animation);
931 inline void StopAnimationMessage(UpdateManager& manager, const Animation& constAnimation)
933 // The scene-graph thread owns this object so it can safely edit it.
934 Animation& animation = const_cast<Animation&>(constAnimation);
936 using LocalType = MessageValue1<UpdateManager, Animation*>;
938 // Reserve some memory inside the message queue
939 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
941 // Construct message in the message queue memory; note that delete should not be called on the return value
942 new(slot) LocalType(&manager, &UpdateManager::StopAnimation, &animation);
945 inline void RemoveAnimationMessage(UpdateManager& manager, const Animation& constAnimation)
947 // The scene-graph thread owns this object so it can safely edit it.
948 Animation& animation = const_cast<Animation&>(constAnimation);
950 using LocalType = MessageValue1<UpdateManager, Animation*>;
952 // Reserve some memory inside the message queue
953 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
955 // Construct message in the message queue memory; note that delete should not be called on the return value
956 new(slot) LocalType(&manager, &UpdateManager::RemoveAnimation, &animation);
959 inline void AddRenderTaskListMessage(UpdateManager& manager, OwnerPointer<SceneGraph::RenderTaskList>& taskList)
961 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::RenderTaskList>>;
963 // Reserve some memory inside the message queue
964 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
966 // Construct message in the message queue memory; note that delete should not be called on the return value
967 new(slot) LocalType(&manager, &UpdateManager::AddRenderTaskList, taskList);
970 inline void RemoveRenderTaskListMessage(UpdateManager& manager, const RenderTaskList& constTaskList)
972 // The scene-graph thread owns this object so it can safely edit it.
973 RenderTaskList& taskList = const_cast<RenderTaskList&>(constTaskList);
975 using LocalType = MessageValue1<UpdateManager, RenderTaskList*>;
977 // Reserve some memory inside the message queue
978 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
980 // Construct message in the message queue memory; note that delete should not be called on the return value
981 new(slot) LocalType(&manager, &UpdateManager::RemoveRenderTaskList, &taskList);
984 inline void AddSceneMessage(UpdateManager& manager, OwnerPointer<SceneGraph::Scene>& scene)
986 using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Scene>>;
988 // Reserve some memory inside the message queue
989 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
991 // Construct message in the message queue memory; note that delete should not be called on the return value
992 new(slot) LocalType(&manager, &UpdateManager::AddScene, scene);
995 inline void RemoveSceneMessage(UpdateManager& manager, const SceneGraph::Scene& constScene)
997 // The scene-graph thread owns this object so it can safely edit it.
998 Scene& scene = const_cast<Scene&>(constScene);
1000 using LocalType = MessageValue1<UpdateManager, Scene*>;
1002 // Reserve some memory inside the message queue
1003 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1005 // Construct message in the message queue memory; note that delete should not be called on the return value
1006 new(slot) LocalType(&manager, &UpdateManager::RemoveScene, &scene);
1009 inline void AddPropertyNotificationMessage(UpdateManager& manager, OwnerPointer<PropertyNotification>& propertyNotification)
1011 // Message has ownership of PropertyNotification while in transit from event -> update
1012 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyNotification>>;
1014 // Reserve some memory inside the message queue
1015 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1017 // Construct message in the message queue memory; note that delete should not be called on the return value
1018 new(slot) LocalType(&manager, &UpdateManager::AddPropertyNotification, propertyNotification);
1021 inline void RemovePropertyNotificationMessage(UpdateManager& manager, const PropertyNotification& constPropertyNotification)
1023 // The scene-graph thread owns this object so it can safely edit it.
1024 PropertyNotification& propertyNotification = const_cast<PropertyNotification&>(constPropertyNotification);
1026 using LocalType = MessageValue1<UpdateManager, PropertyNotification*>;
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::RemovePropertyNotification, &propertyNotification);
1035 inline void PropertyNotificationSetNotifyModeMessage(UpdateManager& manager,
1036 const PropertyNotification* constPropertyNotification,
1037 PropertyNotification::NotifyMode notifyMode)
1039 // The scene-graph thread owns this object so it can safely edit it.
1040 PropertyNotification* propertyNotification = const_cast<PropertyNotification*>(constPropertyNotification);
1042 using LocalType = MessageValue2<UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode>;
1044 // Reserve some memory inside the message queue
1045 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1047 // Construct message in the message queue memory; note that delete should not be called on the return value
1048 new(slot) LocalType(&manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode);
1051 // The render thread can safely change the Shader
1052 inline void AddShaderMessage(UpdateManager& manager, OwnerPointer<Shader>& shader)
1054 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Shader>>;
1056 // Reserve some memory inside the message queue
1057 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1059 // Construct message in the message queue memory; note that delete should not be called on the return value
1060 new(slot) LocalType(&manager, &UpdateManager::AddShader, shader);
1063 // The render thread can safely change the Shader
1064 inline void RemoveShaderMessage(UpdateManager& manager, const Shader* shader)
1066 using LocalType = MessageValue1<UpdateManager, Shader*>;
1068 // Reserve some memory inside the message queue
1069 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1071 // Construct message in the message queue memory; note that delete should not be called on the return value
1072 new(slot) LocalType(&manager, &UpdateManager::RemoveShader, const_cast<Shader*>(shader));
1075 inline void SurfaceReplacedMessage(UpdateManager& manager, const SceneGraph::Scene& constScene)
1077 // The scene-graph thread owns this object so it can safely edit it.
1078 Scene& scene = const_cast<Scene&>(constScene);
1080 using LocalType = MessageValue1<UpdateManager, Scene*>;
1082 // Reserve some memory inside the message queue
1083 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1085 // Construct message in the message queue memory; note that delete should not be called on the return value
1086 new(slot) LocalType(&manager, &UpdateManager::SurfaceReplaced, &scene);
1089 inline void KeepRenderingMessage(UpdateManager& manager, float durationSeconds)
1091 using LocalType = MessageValue1<UpdateManager, float>;
1093 // Reserve some memory inside the message queue
1094 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1096 // Construct message in the message queue memory; note that delete should not be called on the return value
1097 new(slot) LocalType(&manager, &UpdateManager::KeepRendering, durationSeconds);
1100 inline void SetRenderingBehaviorMessage(UpdateManager& manager, DevelStage::Rendering renderingBehavior)
1102 using LocalType = MessageValue1<UpdateManager, DevelStage::Rendering>;
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::SetRenderingBehavior, renderingBehavior);
1111 inline void RequestRenderingMessage(UpdateManager& manager)
1113 using LocalType = Message<UpdateManager>;
1115 // Reserve some memory inside the message queue
1116 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1118 // Construct message in the message queue memory; note that delete should not be called on the return value
1119 new(slot) LocalType(&manager, &UpdateManager::RequestRendering);
1123 * Create a message for setting the depth of a layer
1124 * @param[in] manager The update manager
1125 * @param[in] layers list of layers
1126 * @param[in] rootLayer The rool layer
1128 inline void SetLayerDepthsMessage(UpdateManager& manager, const std::vector<Layer*>& layers, const Layer* rootLayer)
1130 using LocalType = MessageValue2<UpdateManager, std::vector<Layer*>, const Layer*>;
1132 // Reserve some memory inside the message queue
1133 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1135 // Construct message in the message queue memory; note that delete should not be called on the return value
1136 new(slot) LocalType(&manager, &UpdateManager::SetLayerDepths, layers, rootLayer);
1139 inline void AddRendererMessage(UpdateManager& manager, const RendererKey& rendererKey)
1141 using LocalType = MessageValue1<UpdateManager, RendererKey>;
1143 // Reserve some memory inside the message queue
1144 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1145 // Construct message in the message queue memory; note that delete should not be called on the return value
1146 new(slot) LocalType(&manager, &UpdateManager::AddRenderer, rendererKey);
1149 inline void RemoveRendererMessage(UpdateManager& manager, const RendererKey& rendererKey)
1151 using LocalType = MessageValue1<UpdateManager, RendererKey>;
1153 // Reserve some memory inside the message queue
1154 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1155 // Construct message in the message queue memory; note that delete should not be called on the return value
1156 new(slot) LocalType(&manager, &UpdateManager::RemoveRenderer, rendererKey);
1159 inline void AttachRendererMessage(UpdateManager& manager, const Node& node, const Renderer& renderer)
1161 using LocalType = MessageValue2<UpdateManager, Node*, Renderer*>;
1163 // Reserve some memory inside the message queue
1164 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1165 // Construct message in the message queue memory; note that delete should not be called on the return value
1166 new(slot) LocalType(&manager, &UpdateManager::AttachRenderer, const_cast<Node*>(&node), const_cast<Renderer*>(&renderer));
1169 // The render thread can safely change the Shader
1170 inline void AddTextureSetMessage(UpdateManager& manager, OwnerPointer<TextureSet>& textureSet)
1172 using LocalType = MessageValue1<UpdateManager, OwnerPointer<TextureSet>>;
1174 // Reserve some memory inside the message queue
1175 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1177 // Construct message in the message queue memory; note that delete should not be called on the return value
1178 new(slot) LocalType(&manager, &UpdateManager::AddTextureSet, textureSet);
1181 // The render thread can safely change the Shader
1182 inline void RemoveTextureSetMessage(UpdateManager& manager, TextureSet& textureSet)
1184 using LocalType = MessageValue1<UpdateManager, TextureSet*>;
1186 // Reserve some memory inside the message queue
1187 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1189 // Construct message in the message queue memory; note that delete should not be called on the return value
1190 new(slot) LocalType(&manager, &UpdateManager::RemoveTextureSet, &textureSet);
1193 inline void AddSamplerMessage(UpdateManager& manager, OwnerPointer<Render::Sampler>& sampler)
1195 // Message has ownership of Sampler while in transit from event -> update
1196 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Sampler>>;
1198 // Reserve some memory inside the message queue
1199 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::AddSampler, sampler);
1205 inline void RemoveSamplerMessage(UpdateManager& manager, Render::Sampler& sampler)
1207 using LocalType = MessageValue1<UpdateManager, Render::Sampler*>;
1209 // Reserve some memory inside the message queue
1210 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1212 // Construct message in the message queue memory; note that delete should not be called on the return value
1213 new(slot) LocalType(&manager, &UpdateManager::RemoveSampler, &sampler);
1216 inline void SetFilterModeMessage(UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode)
1218 using LocalType = MessageValue3<UpdateManager, Render::Sampler*, uint32_t, uint32_t>;
1220 // Reserve some memory inside the message queue
1221 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1223 // Construct message in the message queue memory; note that delete should not be called on the return value
1224 new(slot) LocalType(&manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode);
1227 inline void SetWrapModeMessage(UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode)
1229 using LocalType = MessageValue4<UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t>;
1231 // Reserve some memory inside the message queue
1232 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1234 // Construct message in the message queue memory; note that delete should not be called on the return value
1235 new(slot) LocalType(&manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode);
1238 inline void AddVertexBuffer(UpdateManager& manager, OwnerPointer<Render::VertexBuffer>& vertexBuffer)
1240 // Message has ownership of vertexBuffer while in transit from event -> update
1241 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::VertexBuffer>>;
1243 // Reserve some memory inside the message queue
1244 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1246 // Construct message in the message queue memory; note that delete should not be called on the return value
1247 new(slot) LocalType(&manager, &UpdateManager::AddVertexBuffer, vertexBuffer);
1250 inline void RemoveVertexBuffer(UpdateManager& manager, Render::VertexBuffer& vertexBuffer)
1252 using LocalType = MessageValue1<UpdateManager, Render::VertexBuffer*>;
1254 // Reserve some memory inside the message queue
1255 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1257 // Construct message in the message queue memory; note that delete should not be called on the return value
1258 new(slot) LocalType(&manager, &UpdateManager::RemoveVertexBuffer, &vertexBuffer);
1261 inline void SetVertexBufferFormat(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format)
1263 // Message has ownership of VertexBuffer::Format while in transit from event -> update
1264 using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, OwnerPointer<Render::VertexBuffer::Format>>;
1266 // Reserve some memory inside the message queue
1267 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1269 // Construct message in the message queue memory; note that delete should not be called on the return value
1270 new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferFormat, &vertexBuffer, format);
1273 inline void SetVertexBufferData(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer<Vector<uint8_t>>& data, uint32_t size)
1275 // Message has ownership of VertexBuffer data while in transit from event -> update
1276 using LocalType = MessageValue3<UpdateManager, Render::VertexBuffer*, OwnerPointer<Vector<uint8_t>>, uint32_t>;
1278 // Reserve some memory inside the message queue
1279 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1281 // Construct message in the message queue memory; note that delete should not be called on the return value
1282 new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferData, &vertexBuffer, data, size);
1285 inline void SetVertexBufferDivisorMessage(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, uint32_t divisor)
1287 using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, uint32_t>;
1288 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1289 new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferDivisor, &vertexBuffer, divisor);
1292 inline void SetVertexBufferUpdateCallback(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, Dali::VertexBufferUpdateCallback* callback)
1294 // Message has ownership of VertexBuffer data while in transit from event -> update
1295 using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, Dali::VertexBufferUpdateCallback*>;
1297 // Reserve some memory inside the message queue
1298 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1300 // Construct message in the message queue memory; note that delete should not be called on the return value
1301 new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferUpdateCallback, &vertexBuffer, callback);
1304 inline void AddGeometry(UpdateManager& manager, OwnerPointer<Render::Geometry>& geometry)
1306 // Message has ownership of Geometry while in transit from event -> update
1307 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Geometry>>;
1309 // Reserve some memory inside the message queue
1310 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1312 // Construct message in the message queue memory; note that delete should not be called on the return value
1313 new(slot) LocalType(&manager, &UpdateManager::AddGeometry, geometry);
1316 inline void RemoveGeometry(UpdateManager& manager, Render::Geometry& geometry)
1318 using LocalType = MessageValue1<UpdateManager, Render::Geometry*>;
1320 // Reserve some memory inside the message queue
1321 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1323 // Construct message in the message queue memory; note that delete should not be called on the return value
1324 new(slot) LocalType(&manager, &UpdateManager::RemoveGeometry, &geometry);
1327 inline void AttachVertexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer)
1329 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
1331 // Reserve some memory inside the message queue
1332 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1334 // Construct message in the message queue memory; note that delete should not be called on the return value
1335 new(slot) LocalType(&manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer));
1338 inline void RemoveVertexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer)
1340 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
1342 // Reserve some memory inside the message queue
1343 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1345 // Construct message in the message queue memory; note that delete should not be called on the return value
1346 new(slot) LocalType(&manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer));
1349 // Custom message type for SetIndexBuffer() used to move data with Vector::Swap()
1350 template<typename T, typename IndexContainerType>
1351 class IndexBufferMessage : public MessageBase
1355 * Constructor which does a Vector::Swap()
1357 IndexBufferMessage(T* manager, Render::Geometry* geometry, IndexContainerType& indices)
1360 mRenderGeometry(geometry)
1362 mIndices.Swap(indices);
1366 * Virtual destructor
1368 ~IndexBufferMessage() override = default;
1371 * @copydoc MessageBase::Process
1373 void Process(BufferIndex /*bufferIndex*/) override
1375 DALI_ASSERT_DEBUG(mManager && "Message does not have an object");
1376 mManager->SetIndexBuffer(mRenderGeometry, mIndices);
1381 Render::Geometry* mRenderGeometry;
1382 IndexContainerType mIndices;
1385 inline void SetIndexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, Render::Geometry::Uint16ContainerType& indices)
1387 using LocalType = IndexBufferMessage<UpdateManager, Render::Geometry::Uint16ContainerType>;
1389 // Reserve some memory inside the message queue
1390 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1392 // Construct message in the message queue memory; note that delete should not be called on the return value
1393 new(slot) LocalType(&manager, &geometry, indices);
1396 inline void SetIndexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, Render::Geometry::Uint32ContainerType& indices)
1398 using LocalType = IndexBufferMessage<UpdateManager, Render::Geometry::Uint32ContainerType>;
1400 // Reserve some memory inside the message queue
1401 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1403 // Construct message in the message queue memory; note that delete should not be called on the return value
1404 new(slot) LocalType(&manager, &geometry, indices);
1407 inline void SetGeometryTypeMessage(UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType)
1409 using LocalType = MessageValue2<UpdateManager, Render::Geometry*, uint32_t>;
1411 // Reserve some memory inside the message queue
1412 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1414 // Construct message in the message queue memory; note that delete should not be called on the return value
1415 new(slot) LocalType(&manager, &UpdateManager::SetGeometryType, &geometry, geometryType);
1418 inline void AddTextureMessage(UpdateManager& manager, const Render::TextureKey& texture)
1420 using LocalType = MessageValue1<UpdateManager, Render::TextureKey>;
1422 // Reserve some memory inside the message queue
1423 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1425 // Construct message in the message queue memory; note that delete should not be called on the return value
1426 new(slot) LocalType(&manager, &UpdateManager::AddTexture, texture);
1429 inline void RemoveTextureMessage(UpdateManager& manager, const Render::TextureKey& texture)
1431 using LocalType = MessageValue1<UpdateManager, Render::TextureKey>;
1433 // Reserve some memory inside the message queue
1434 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1436 // Construct message in the message queue memory; note that delete should not be called on the return value
1437 new(slot) LocalType(&manager, &UpdateManager::RemoveTexture, texture);
1440 inline void UploadTextureMessage(UpdateManager& manager, Render::TextureKey texture, PixelDataPtr pixelData, const Texture::UploadParams& params)
1442 using LocalType = MessageValue3<UpdateManager, Render::TextureKey, PixelDataPtr, Texture::UploadParams>;
1444 // Reserve some memory inside the message queue
1445 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1447 // Construct message in the message queue memory; note that delete should not be called on the return value
1448 new(slot) LocalType(&manager, &UpdateManager::UploadTexture, texture, pixelData, params);
1451 inline void GenerateMipmapsMessage(UpdateManager& manager, Render::TextureKey texture)
1453 using LocalType = MessageValue1<UpdateManager, Render::TextureKey>;
1455 // Reserve some memory inside the message queue
1456 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1458 // Construct message in the message queue memory; note that delete should not be called on the return value
1459 new(slot) LocalType(&manager, &UpdateManager::GenerateMipmaps, texture);
1462 inline void AddFrameBuffer(UpdateManager& manager, OwnerPointer<Render::FrameBuffer>& frameBuffer)
1464 using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::FrameBuffer>>;
1466 // Reserve some memory inside the message queue
1467 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1469 // Construct message in the message queue memory; note that delete should not be called on the return value
1470 new(slot) LocalType(&manager, &UpdateManager::AddFrameBuffer, frameBuffer);
1473 inline void RemoveFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer)
1475 using LocalType = MessageValue1<UpdateManager, Render::FrameBuffer*>;
1477 // Reserve some memory inside the message queue
1478 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1480 // Construct message in the message queue memory; note that delete should not be called on the return value
1481 new(slot) LocalType(&manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer);
1484 inline void AttachColorTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer)
1486 using LocalType = MessageValue4<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t>;
1488 // Reserve some memory inside the message queue
1489 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1491 // Construct message in the message queue memory; note that delete should not be called on the return value
1492 new(slot) LocalType(&manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer);
1495 inline void AttachDepthTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
1497 using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
1499 // Reserve some memory inside the message queue
1500 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1502 // Construct message in the message queue memory; note that delete should not be called on the return value
1503 new(slot) LocalType(&manager, &UpdateManager::AttachDepthTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel);
1506 inline void AttachDepthStencilTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
1508 using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
1510 // Reserve some memory inside the message queue
1511 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1513 // Construct message in the message queue memory; note that delete should not be called on the return value
1514 new(slot) LocalType(&manager, &UpdateManager::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel);
1517 inline void SetMultiSamplingLevelToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, uint8_t multiSamplingLevel)
1519 using LocalType = MessageValue2<UpdateManager, Render::FrameBuffer*, uint8_t>;
1521 // Reserve some memory inside the message queue
1522 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1524 // Construct message in the message queue memory; note that delete should not be called on the return value
1525 new(slot) LocalType(&manager, &UpdateManager::SetMultiSamplingLevelToFrameBuffer, &frameBuffer, multiSamplingLevel);
1528 inline void SetDepthIndicesMessage(UpdateManager& manager, OwnerPointer<NodeDepths>& nodeDepths)
1530 using LocalType = MessageValue1<UpdateManager, OwnerPointer<NodeDepths>>;
1532 // Reserve some memory inside the message queue
1533 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1535 // Construct message in the message queue memory; note that delete should not be called on the return value
1536 new(slot) LocalType(&manager, &UpdateManager::SetDepthIndices, nodeDepths);
1539 inline void AddResetterMessage(UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter)
1541 using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyResetterBase>>;
1543 // Reserve some memory inside the message queue
1544 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1546 // Construct message in the message queue memory; note that delete should not be called on the return value
1547 new(slot) LocalType(&manager, &UpdateManager::AddPropertyResetter, resetter);
1550 inline void AddFrameCallbackMessage(UpdateManager& manager, OwnerPointer<FrameCallback>& frameCallback, const Node& rootNode)
1552 using LocalType = MessageValue2<UpdateManager, OwnerPointer<FrameCallback>, const Node*>;
1554 // Reserve some memory inside the message queue
1555 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1557 // Construct message in the message queue memory; note that delete should not be called on the return value
1558 new(slot) LocalType(&manager, &UpdateManager::AddFrameCallback, frameCallback, &rootNode);
1561 inline void RemoveFrameCallbackMessage(UpdateManager& manager, FrameCallbackInterface& frameCallback)
1563 using LocalType = MessageValue1<UpdateManager, FrameCallbackInterface*>;
1565 // Reserve some memory inside the message queue
1566 uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
1568 // Construct message in the message queue memory; note that delete should not be called on the return value
1569 new(slot) LocalType(&manager, &UpdateManager::RemoveFrameCallback, &frameCallback);
1572 } // namespace SceneGraph
1574 } // namespace Internal
1578 #endif // DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H