X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fmanager%2Fupdate-manager.h;h=4f2214af20fc54062f6305abb05247514e3ac651;hb=5b712a1b5fda4ee48e03f5ce462dd4c506fec014;hp=401eb8b427cfd753636a3a7bcfc3e6df768ac68d;hpb=cd0ce6e412df8961b1a5e28b496369fa49fd72d7;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index 401eb8b..4f2214a 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,14 +32,17 @@ #include #include #include +#include #include #include +#include // for OwnerPointer< FrameCallback > #include // for OwnerPointer< Renderer > #include // for OwnerPointer< TextureSet > #include #include +#include #include // for OwnerPointer< Shader > -#include +#include #include namespace Dali @@ -80,7 +83,7 @@ class RenderManager; class RenderTaskList; class RenderTaskProcessor; class RenderQueue; -class PropertyBuffer; +class VertexBuffer; struct NodeDepthPair { @@ -95,9 +98,7 @@ struct NodeDepthPair struct NodeDepths { - NodeDepths() - { - } + NodeDepths() = default; void Add( SceneGraph::Node* node, uint32_t sortedDepth ) { @@ -143,20 +144,27 @@ public: /** * Destructor. */ - virtual ~UpdateManager(); + ~UpdateManager() override; // Node connection methods /** * Installs a new layer as the root node. - * @pre The UpdateManager does not already have an installed root node. * @pre The layer is of derived Node type Layer. * @pre The layer does not have a parent. * @param[in] layer The new root node. - * @param[in] systemLevel True if using the system-level overlay. * @post The node is owned by UpdateManager. */ - void InstallRoot( OwnerPointer& layer, bool systemLevel ); + void InstallRoot( OwnerPointer& layer ); + + /** + * Uninstalls the root node. + * @pre The layer is of derived Node type Layer. + * @pre The layer does not have a parent. + * @param[in] layer The root node. + * @post The node is owned by UpdateManager. + */ + void UninstallRoot( Layer* layer ); /** * Add a Node; UpdateManager takes ownership. @@ -201,7 +209,7 @@ public: * Remove a camera from scene * @param[in] camera to remove */ - void RemoveCamera( const Camera* camera ); + void RemoveCamera( Camera* camera ); /** * Add a newly created object. @@ -216,6 +224,32 @@ public: */ void RemoveObject( PropertyOwner* object ); + /** + * Add a newly created render task list. + * @param[in] taskList The render task list to add. + * @post The render task list is owned by UpdateManager. + */ + void AddRenderTaskList( OwnerPointer& taskList ); + + /** + * Remove a render task list. + * @param[in] taskList The render task list to remove. + */ + void RemoveRenderTaskList( RenderTaskList* taskList ); + + /** + * Add a newly created scene. + * @param[in] scene The scene to add. + * @post The scene is owned by UpdateManager. + */ + void AddScene( OwnerPointer& scene ); + + /** + * Remove a scene. + * @param[in] scene The scene to remove. + */ + void RemoveScene( Scene* scene ); + // Animations /** @@ -301,7 +335,7 @@ public: * @brief Accept compiled shaders passed back on render thread for saving. * @param[in] shaderData Source code, hash over source, and corresponding compiled binary to be saved. */ - virtual void SaveBinary( Internal::ShaderDataPtr shaderData ); + void SaveBinary( Internal::ShaderDataPtr shaderData ) override; /** * @brief Set the destination for compiled shader binaries to be passed on to. @@ -434,31 +468,31 @@ public: * @post Sends a message to RenderManager to add the property buffer. * The property buffer will be owned by RenderManager */ - void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertryBuffer ); + void AddVertexBuffer( OwnerPointer< Render::VertexBuffer >& propertryBuffer ); /** - * Removes an existing PropertyBuffer from RenderManager + * Removes an existing VertexBuffer from RenderManager * @param[in] propertryBuffer The property buffer to remove * @post The property buffer will be destroyed in the render thread */ - void RemovePropertyBuffer( Render::PropertyBuffer* propertryBuffer ); + void RemoveVertexBuffer( Render::VertexBuffer* propertryBuffer ); /** * Sets the format of an existing property buffer - * @param[in] propertyBuffer The property buffer. + * @param[in] vertexBuffer The property buffer. * @param[in] format The new format of the buffer * @post Sends a message to RenderManager to set the new format to the property buffer. */ - void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format ); + void SetVertexBufferFormat( Render::VertexBuffer* vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format ); /** * Sets the data of an existing property buffer - * @param[in] propertyBuffer The property buffer. + * @param[in] vertexBuffer The property buffer. * @param[in] data The new data of the buffer * @param[in] size The new size of the buffer * @post Sends a message to RenderManager to set the new data to the property buffer. */ - void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ); + void SetVertexBufferData( Render::VertexBuffer* vertexBuffer, OwnerPointer< Vector >& data, uint32_t size ); /** * Adds a geometry to the RenderManager @@ -492,16 +526,16 @@ public: /** * Adds a vertex buffer to a geometry * @param[in] geometry The geometry - * @param[in] propertyBuffer The property buffer + * @param[in] vertexBuffer The property buffer */ - void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); + void AttachVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ); /** * Removes a vertex buffer from a geometry * @param[in] geometry The geometry - * @param[in] propertyBuffer The property buffer + * @param[in] vertexBuffer The property buffer */ - void RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); + void RemoveVertexBuffer( Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer ); /** * Adds a texture to the render manager @@ -536,7 +570,7 @@ public: * @param[in] frameBuffer The framebuffer to add * The framebuffer will be owned by RenderManager */ - void AddFrameBuffer( Render::FrameBuffer* frameBuffer ); + void AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer ); /** * Removes a FrameBuffer from the render manager @@ -554,6 +588,28 @@ public: */ void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face ); + /** + * Attach a texture as depth output to an existing FrameBuffer + * @param[in] frameBuffer The FrameBuffer + * @param[in] texture The texture that will be used as output when rendering + * @param[in] mipmapLevel The mipmap of the texture to be attached + */ + void AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel ); + + /** + * Attach a texture as depth/stencil output to an existing FrameBuffer + * @param[in] frameBuffer The FrameBuffer + * @param[in] texture The texture that will be used as output when rendering + * @param[in] mipmapLevel The mipmap of the texture to be attached + */ + void AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel ); + + /** + * This is called when the surface of the scene has been replaced. + * @param[in] scene The scene. + */ + void SurfaceReplaced( Scene* scene ); + public: /** @@ -572,18 +628,18 @@ public: bool isRenderingToFbo ); /** - * Set the background color i.e. the glClear color used at the beginning of each frame. - * @param[in] color The new background color. - */ - void SetBackgroundColor(const Vector4& color); - - /** * Set the default surface rect. * @param[in] rect The rect value representing the surface. */ void SetDefaultSurfaceRect( const Rect& rect ); /** + * Set the default surface orientation. + * @param[in] orientation The orientation value representing the surface. + */ + void SetDefaultSurfaceOrientation(int orientation); + + /** * @copydoc Dali::Stage::KeepRendering() */ void KeepRendering( float durationSeconds ); @@ -594,11 +650,19 @@ public: void SetRenderingBehavior( DevelStage::Rendering renderingBehavior ); /** + * Request to render the current frame + * @note This is a temporary workaround (to be removed in the future) to request the rendering of + * the current frame if the color or visibility of any actor is updated. It MUST NOT be used + * for any other purposes. + */ + void RequestRendering(); + + /** * Sets the depths of all layers. * @param layers The layers in depth order. - * @param[in] systemLevel True if using the system-level overlay. + * @param[in] rootLayer The root layer of the sorted layers. */ - void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel ); + void SetLayerDepths( const std::vector< Layer* >& layers, const Layer* rootLayer ); /** * Set the depth indices of all nodes (in LayerUI's) @@ -614,10 +678,10 @@ public: /** * Adds an implementation of the FrameCallbackInterface. - * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface + * @param[in] frameCallback An OwnerPointer to the SceneGraph FrameCallback object * @param[in] rootNode A pointer to the root node to apply the FrameCallback to */ - void AddFrameCallback( FrameCallbackInterface* frameCallback, const Node* rootNode ); + void AddFrameCallback( OwnerPointer< FrameCallback >& frameCallback, const Node* rootNode ); /** * Removes the specified implementation of FrameCallbackInterface. @@ -659,8 +723,9 @@ private: * Perform animation updates * @param[in] bufferIndex to use * @param[in] elapsedSeconds time since last frame + * @return true if at least one animations is currently active or false otherwise */ - void Animate( BufferIndex bufferIndex, float elapsedSeconds ); + bool Animate( BufferIndex bufferIndex, float elapsedSeconds ); /** * Applies constraints to CustomObjects @@ -715,22 +780,36 @@ private: // Messages for UpdateManager -inline void InstallRootMessage( UpdateManager& manager, OwnerPointer& root, bool systemLevel ) +inline void InstallRootMessage( UpdateManager& manager, OwnerPointer& root ) { // Message has ownership of Layer while in transit from event -> update - typedef MessageValue2< UpdateManager, OwnerPointer, bool > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root, systemLevel ); + new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root ); +} + +inline void UninstallRootMessage( UpdateManager& manager, const Layer* constRoot ) +{ + // Scene graph thread can destroy this object. + Layer* root = const_cast< Layer* >( constRoot ); + + using LocalType = MessageValue1; + + // Reserve some memory inside the message queue + uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::UninstallRoot, root ); } inline void AddNodeMessage( UpdateManager& manager, OwnerPointer& node ) { // Message has ownership of Node while in transit from event -> update - typedef MessageValue1< UpdateManager, OwnerPointer > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -745,7 +824,7 @@ inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, Node& parent = const_cast< Node& >( constParent ); Node& child = const_cast< Node& >( constChild ); - typedef MessageValue2< UpdateManager, Node*, Node* > LocalType; + using LocalType = MessageValue2; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -759,7 +838,7 @@ inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode // Scene graph thread can modify this object. Node& node = const_cast< Node& >( constNode ); - typedef MessageValue1< UpdateManager, Node* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -773,7 +852,7 @@ inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode ) // Scene graph thread can destroy this object. Node& node = const_cast< Node& >( constNode ); - typedef MessageValue1< UpdateManager, Node* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -785,7 +864,7 @@ inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode ) inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& camera ) { // Message has ownership of Camera while in transit from event -> update - typedef MessageValue1< UpdateManager, OwnerPointer< Camera > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -796,19 +875,19 @@ inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& ca inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera ) { - typedef MessageValue1< UpdateManager, const Camera* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, camera ); + new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, const_cast( camera ) ); } inline void AddObjectMessage( UpdateManager& manager, OwnerPointer& object ) { // Message has ownership of object while in transit from event -> update - typedef MessageValue1< UpdateManager, OwnerPointer > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -817,20 +896,20 @@ inline void AddObjectMessage( UpdateManager& manager, OwnerPointer LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object ); + new (slot) LocalType( &manager, &UpdateManager::RemoveObject, const_cast( object ) ); } inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation ) { - typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::Animation > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -844,7 +923,7 @@ inline void StopAnimationMessage( UpdateManager& manager, const Animation& const // The scene-graph thread owns this object so it can safely edit it. Animation& animation = const_cast< Animation& >( constAnimation ); - typedef MessageValue1< UpdateManager, Animation* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -858,7 +937,7 @@ inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& con // The scene-graph thread owns this object so it can safely edit it. Animation& animation = const_cast< Animation& >( constAnimation ); - typedef MessageValue1< UpdateManager, Animation* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -867,10 +946,60 @@ inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& con new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation ); } +inline void AddRenderTaskListMessage( UpdateManager& manager, OwnerPointer< SceneGraph::RenderTaskList >& taskList ) +{ + using LocalType = MessageValue1 >; + + // Reserve some memory inside the message queue + uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::AddRenderTaskList, taskList ); +} + +inline void RemoveRenderTaskListMessage( UpdateManager& manager, const RenderTaskList& constTaskList ) +{ + // The scene-graph thread owns this object so it can safely edit it. + RenderTaskList& taskList = const_cast< RenderTaskList& >( constTaskList ); + + using LocalType = MessageValue1; + + // Reserve some memory inside the message queue + uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::RemoveRenderTaskList, &taskList ); +} + +inline void AddSceneMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Scene >& scene ) +{ + using LocalType = MessageValue1 >; + + // Reserve some memory inside the message queue + uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::AddScene, scene ); +} + +inline void RemoveSceneMessage( UpdateManager& manager, const SceneGraph::Scene& constScene ) +{ + // The scene-graph thread owns this object so it can safely edit it. + Scene& scene = const_cast< Scene& >( constScene ); + + using LocalType = MessageValue1; + + // Reserve some memory inside the message queue + uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::RemoveScene, &scene ); +} + inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification ) { // Message has ownership of PropertyNotification while in transit from event -> update - typedef MessageValue1< UpdateManager, OwnerPointer< PropertyNotification > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -884,7 +1013,7 @@ inline void RemovePropertyNotificationMessage( UpdateManager& manager, const Pro // The scene-graph thread owns this object so it can safely edit it. PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification ); - typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -900,7 +1029,7 @@ inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager, // The scene-graph thread owns this object so it can safely edit it. PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification ); - typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType; + using LocalType = MessageValue2; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -912,7 +1041,7 @@ inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager, // The render thread can safely change the Shader inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& shader ) { - typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -922,56 +1051,70 @@ inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& sh } // The render thread can safely change the Shader -inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader ) +inline void RemoveShaderMessage( UpdateManager& manager, const Shader* shader ) { - typedef MessageValue1< UpdateManager, Shader* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader ); + new (slot) LocalType( &manager, &UpdateManager::RemoveShader, const_cast( shader ) ); } inline void SetShaderProgramMessage( UpdateManager& manager, - Shader& shader, + const Shader& shader, Internal::ShaderDataPtr shaderData, bool modifiesGeometry ) { - typedef MessageValue3< UpdateManager, Shader*, Internal::ShaderDataPtr, bool > LocalType; + using LocalType = MessageValue3; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, shaderData, modifiesGeometry ); + new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, const_cast( &shader ), shaderData, modifiesGeometry ); } -inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color ) +inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect& rect ) { - typedef MessageValue1< UpdateManager, Vector4 > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color ); + new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect ); } -inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect& rect ) +inline void SurfaceReplacedMessage( UpdateManager& manager, const SceneGraph::Scene& constScene ) { - typedef MessageValue1< UpdateManager, Rect > LocalType; + // The scene-graph thread owns this object so it can safely edit it. + Scene& scene = const_cast< Scene& >( constScene ); + + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect ); + new (slot) LocalType( &manager, &UpdateManager::SurfaceReplaced, &scene ); +} + +inline void SetDefaultSurfaceOrientationMessage(UpdateManager& manager, int orientation) +{ + using LocalType = MessageValue1; + + // Reserve some memory inside the message queue + unsigned int* slot = manager.ReserveMessageSlot(sizeof(LocalType)); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new(slot) LocalType(&manager, &UpdateManager::SetDefaultSurfaceOrientation, orientation); } inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds ) { - typedef MessageValue1< UpdateManager, float > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -982,7 +1125,7 @@ inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds inline void SetRenderingBehaviorMessage( UpdateManager& manager, DevelStage::Rendering renderingBehavior ) { - typedef MessageValue1< UpdateManager, DevelStage::Rendering > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -991,26 +1134,37 @@ inline void SetRenderingBehaviorMessage( UpdateManager& manager, DevelStage::Ren new (slot) LocalType( &manager, &UpdateManager::SetRenderingBehavior, renderingBehavior ); } +inline void RequestRenderingMessage( UpdateManager& manager ) +{ + using LocalType = Message; + + // Reserve some memory inside the message queue + uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::RequestRendering ); +} + /** * Create a message for setting the depth of a layer * @param[in] manager The update manager * @param[in] layers list of layers - * @param[in] systemLevel True if the layers are added via the SystemOverlay API + * @param[in] rootLayer The rool layer */ -inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel ) +inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, const Layer* rootLayer ) { - typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType; + using LocalType = MessageValue2, const Layer*>; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel ); + new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, rootLayer ); } inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >& object ) { - typedef MessageValue1< UpdateManager, OwnerPointer< Renderer > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1018,20 +1172,20 @@ inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer > new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object ); } -inline void RemoveRendererMessage( UpdateManager& manager, Renderer& object ) +inline void RemoveRendererMessage( UpdateManager& manager, const Renderer& object ) { - typedef MessageValue1< UpdateManager, Renderer* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, &object ); + new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, const_cast( &object ) ); } // The render thread can safely change the Shader inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureSet >& textureSet ) { - typedef MessageValue1< UpdateManager, OwnerPointer< TextureSet > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1043,7 +1197,7 @@ inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureS // The render thread can safely change the Shader inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& textureSet ) { - typedef MessageValue1< UpdateManager, TextureSet* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1055,7 +1209,7 @@ inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& texture inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sampler >& sampler ) { // Message has ownership of Sampler while in transit from event -> update - typedef MessageValue1< UpdateManager, OwnerPointer< Render::Sampler > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1066,7 +1220,7 @@ inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sam inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampler ) { - typedef MessageValue1< UpdateManager, Render::Sampler* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1077,7 +1231,7 @@ inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampl inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode ) { - typedef MessageValue3< UpdateManager, Render::Sampler*, uint32_t, uint32_t > LocalType; + using LocalType = MessageValue3; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1088,7 +1242,7 @@ inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampl inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode ) { - typedef MessageValue4< UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t > LocalType; + using LocalType = MessageValue4; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1097,57 +1251,57 @@ inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode ); } -inline void AddPropertyBuffer( UpdateManager& manager, OwnerPointer< Render::PropertyBuffer >& propertyBuffer ) +inline void AddVertexBuffer( UpdateManager& manager, OwnerPointer< Render::VertexBuffer >& vertexBuffer ) { - // Message has ownership of propertyBuffer while in transit from event -> update - typedef MessageValue1< UpdateManager, OwnerPointer< Render::PropertyBuffer > > LocalType; + // Message has ownership of vertexBuffer while in transit from event -> update + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, propertyBuffer ); + new (slot) LocalType( &manager, &UpdateManager::AddVertexBuffer, vertexBuffer ); } -inline void RemovePropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer ) +inline void RemoveVertexBuffer( UpdateManager& manager, Render::VertexBuffer& vertexBuffer ) { - typedef MessageValue1< UpdateManager, Render::PropertyBuffer* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::RemovePropertyBuffer, &propertyBuffer ); + new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &vertexBuffer ); } -inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format ) +inline void SetVertexBufferFormat( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Render::VertexBuffer::Format>& format ) { - // Message has ownership of PropertyBuffer::Format while in transit from event -> update - typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format> > LocalType; + // Message has ownership of VertexBuffer::Format while in transit from event -> update + using LocalType = MessageValue2 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferFormat, &propertyBuffer, format ); + new (slot) LocalType( &manager, &UpdateManager::SetVertexBufferFormat, &vertexBuffer, format ); } -inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ) +inline void SetVertexBufferData( UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer< Vector >& data, uint32_t size ) { - // Message has ownership of PropertyBuffer data while in transit from event -> update - typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector >, uint32_t > LocalType; + // Message has ownership of VertexBuffer data while in transit from event -> update + using LocalType = MessageValue3 >, uint32_t>; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data, size ); + new (slot) LocalType( &manager, &UpdateManager::SetVertexBufferData, &vertexBuffer, data, size ); } inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry >& geometry ) { // Message has ownership of Geometry while in transit from event -> update - typedef MessageValue1< UpdateManager, OwnerPointer< Render::Geometry > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1158,7 +1312,7 @@ inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry ) { - typedef MessageValue1< UpdateManager, Render::Geometry* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1167,26 +1321,26 @@ inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry ) new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry ); } -inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer ) +inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer ) { - typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType; + using LocalType = MessageValue2; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast(&vertexBuffer) ); + new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast(&vertexBuffer) ); } -inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer ) +inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer ) { - typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType; + using LocalType = MessageValue2; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast(&vertexBuffer) ); + new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast(&vertexBuffer) ); } // Custom message type for SetIndexBuffer() used to move data with Vector::Swap() @@ -1209,14 +1363,12 @@ public: /** * Virtual destructor */ - virtual ~IndexBufferMessage() - { - } + ~IndexBufferMessage() override = default; /** * @copydoc MessageBase::Process */ - virtual void Process( BufferIndex /*bufferIndex*/ ) + void Process( BufferIndex /*bufferIndex*/ ) override { DALI_ASSERT_DEBUG( mManager && "Message does not have an object" ); mManager->SetIndexBuffer( mRenderGeometry, mIndices ); @@ -1231,7 +1383,7 @@ private: inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector& indices ) { - typedef IndexBufferMessage< UpdateManager > LocalType; + using LocalType = IndexBufferMessage; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1242,7 +1394,7 @@ inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geo inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType ) { - typedef MessageValue2< UpdateManager, Render::Geometry*, uint32_t > LocalType; + using LocalType = MessageValue2; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1254,7 +1406,7 @@ inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& ge inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& texture ) { // Message has ownership of Texture while in transit from event -> update - typedef MessageValue1< UpdateManager, OwnerPointer< Render::Texture > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1265,7 +1417,7 @@ inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture ) { - typedef MessageValue1< UpdateManager, Render::Texture* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1276,7 +1428,7 @@ inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture ) inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& texture, PixelDataPtr pixelData, const Texture::UploadParams& params ) { - typedef MessageValue3< UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams > LocalType; + using LocalType = MessageValue3; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1287,7 +1439,7 @@ inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& textu inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& texture ) { - typedef MessageValue1< UpdateManager, Render::Texture* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1297,20 +1449,20 @@ inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& tex } -inline void AddFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer ) +inline void AddFrameBuffer( UpdateManager& manager, OwnerPointer< Render::FrameBuffer >& frameBuffer ) { - typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, &frameBuffer ); + new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, frameBuffer ); } inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer ) { - typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1321,7 +1473,7 @@ inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& fram inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer ) { - typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t > LocalType; + using LocalType = MessageValue4; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1330,9 +1482,31 @@ inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::Fra new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer ); } +inline void AttachDepthTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel ) +{ + using LocalType = MessageValue3; + + // Reserve some memory inside the message queue + uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::AttachDepthTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel ); +} + +inline void AttachDepthStencilTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel ) +{ + using LocalType = MessageValue3; + + // Reserve some memory inside the message queue + uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &manager, &UpdateManager::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel ); +} + inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDepths >& nodeDepths ) { - typedef MessageValue1< UpdateManager, OwnerPointer< NodeDepths > > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1343,7 +1517,7 @@ inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDe inline void AddResetterMessage( UpdateManager& manager, OwnerPointer resetter ) { - typedef MessageValue1< UpdateManager, OwnerPointer > LocalType; + using LocalType = MessageValue1 >; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); @@ -1352,20 +1526,20 @@ inline void AddResetterMessage( UpdateManager& manager, OwnerPointer& frameCallback, const Node& rootNode ) { - typedef MessageValue2< UpdateManager, FrameCallbackInterface*, const Node* > LocalType; + using LocalType = MessageValue2, const Node*>; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::AddFrameCallback, &frameCallback, &rootNode ); + new (slot) LocalType( &manager, &UpdateManager::AddFrameCallback, frameCallback, &rootNode ); } inline void RemoveFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback ) { - typedef MessageValue1< UpdateManager, FrameCallbackInterface* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );