X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fmanager%2Fupdate-manager.h;h=3983bdbd2253e6dd936ddd5f555e8b95b8b58685;hb=d2bc18872d7b4f316b86a0897e6c9fabf67a1241;hp=96588bda23230c7b9e9e9ca9b88905a50bba96cf;hpb=f797020286aa82bac8afdd6a8c0fb6dcb2326781;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 96588bd..3983bdb 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) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -22,19 +22,24 @@ #include #include +#include + #include #include #include #include #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 @@ -42,6 +47,8 @@ namespace Dali { +class FrameCallbackInterface; + namespace Integration { class GlSyncAbstraction; @@ -144,14 +151,21 @@ public: /** * 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. @@ -188,7 +202,7 @@ public: /** * Add a camera on scene - * @param[in] camera to add + * @param[in] camera The camera to add */ void AddCamera( OwnerPointer< Camera >& camera ); @@ -196,7 +210,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. @@ -211,6 +225,19 @@ 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 ); + // Animations /** @@ -238,6 +265,13 @@ public: */ bool IsAnimationRunning() const; + /** + * Add a property resetter. UpdateManager takes ownership of the object. + * It will be killed by UpdateManager when the associated animator or + * constraint has finished; or the property owner of the property is destroyed. + */ + void AddPropertyResetter( OwnerPointer& propertyResetter ); + // Property Notification /** @@ -359,7 +393,7 @@ public: * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot. * @return A pointer to the first char allocated for the message. */ - unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true ); + uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene = true ); /** * @return the current event-buffer index. @@ -405,7 +439,7 @@ public: * @param[in] minFilterMode The filter to use under minification * @param[in] magFilterMode The filter to use under magnification */ - void SetFilterMode( Render::Sampler* sampler, unsigned int minFilterMode, unsigned int magFilterMode ); + void SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode ); /** * Sets the wrap mode for an existing sampler @@ -414,7 +448,7 @@ public: * @param[in] sWrapMode Wrapping mode in x direction * @param[in] tWrapMode Wrapping mode in y direction */ - void SetWrapMode( Render::Sampler* sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode ); + void SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode ); /** * Add a new property buffer to RenderManager @@ -446,7 +480,7 @@ public: * @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, size_t size ); + void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ); /** * Adds a geometry to the RenderManager @@ -468,14 +502,14 @@ public: * @param[in] geometry The geometry * @param[in] geometryType The type of the geometry */ - void SetGeometryType( Render::Geometry* geometry, unsigned int geometryType ); + void SetGeometryType( Render::Geometry* geometry, uint32_t geometryType ); /** * Sets the index buffer to be used by a geometry * @param[in] geometry The geometry * @param[in] indices A vector containing the indices for the geometry */ - void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& indices ); + void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& indices ); /** * Adds a vertex buffer to a geometry @@ -524,7 +558,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 @@ -540,7 +574,7 @@ public: * @param[in] mipmapLevel The mipmap of the texture to be attached * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures */ - void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int face ); + void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face ); public: @@ -549,9 +583,15 @@ public: * @param[in] elapsedSeconds The elapsed time that should be applied to animations. * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync. * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync. + * @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled. + * @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object. * @return True if further updates are required e.g. during animations. */ - unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds ); + uint32_t Update( float elapsedSeconds, + uint32_t lastVSyncTimeMilliseconds, + uint32_t nextVSyncTimeMilliseconds, + bool renderToFboEnabled, + bool isRenderingToFbo ); /** * Set the background color i.e. the glClear color used at the beginning of each frame. @@ -566,16 +606,27 @@ public: 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 ); /** + * @copydoc Dali::DevelStage::SetRenderingBehavior() + */ + void SetRenderingBehavior( DevelStage::Rendering renderingBehavior ); + + /** * 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) @@ -583,6 +634,25 @@ public: */ void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths ); + /** + * Query wheter the default surface rect is changed or not. + * @return true if the default surface rect is changed. + */ + bool IsDefaultSurfaceRectChanged(); + + /** + * Adds an 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( OwnerPointer< FrameCallback >& frameCallback, const Node* rootNode ); + + /** + * Removes the specified implementation of FrameCallbackInterface. + * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to remove. + */ + void RemoveFrameCallback( FrameCallbackInterface* frameCallback ); + private: // Undefined @@ -596,7 +666,7 @@ private: * @param[in] elapsedSeconds The time in seconds since the previous update. * @return True if the update-thread should keep going. */ - unsigned int KeepUpdatingCheck( float elapsedSeconds ) const; + uint32_t KeepUpdatingCheck( float elapsedSeconds ) const; /** * Helper to reset all Node properties @@ -611,7 +681,7 @@ private: * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds. * @return true, if any properties were updated. */ - bool ProcessGestures( BufferIndex bufferIndex, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds ); + bool ProcessGestures( BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds ); /** * Perform animation updates @@ -673,16 +743,30 @@ 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; + typedef MessageValue1< UpdateManager, OwnerPointer > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ); +} + +inline void UninstallRootMessage( UpdateManager& manager, const Layer* constRoot ) +{ + // Scene graph thread can destroy this object. + Layer* root = const_cast< Layer* >( constRoot ); + + typedef MessageValue1< UpdateManager, Layer* > LocalType; + + // 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::UninstallRoot, root ); } inline void AddNodeMessage( UpdateManager& manager, OwnerPointer& node ) @@ -691,7 +775,7 @@ inline void AddNodeMessage( UpdateManager& manager, OwnerPointer& node ) typedef MessageValue1< UpdateManager, OwnerPointer > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddNode, node ); @@ -706,7 +790,7 @@ inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, typedef MessageValue2< UpdateManager, Node*, Node* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::ConnectNode, &parent, &child ); @@ -720,7 +804,7 @@ inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode typedef MessageValue1< UpdateManager, Node* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::DisconnectNode, &node ); @@ -734,7 +818,7 @@ inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode ) typedef MessageValue1< UpdateManager, Node* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::DestroyNode, &node ); @@ -746,7 +830,7 @@ inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& ca typedef MessageValue1< UpdateManager, OwnerPointer< Camera > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddCamera, camera ); @@ -754,13 +838,13 @@ inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& ca inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera ) { - typedef MessageValue1< UpdateManager, const Camera* > LocalType; + typedef MessageValue1< UpdateManager, Camera* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ) @@ -769,21 +853,21 @@ inline void AddObjectMessage( UpdateManager& manager, OwnerPointer > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddObject, object ); } -inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object ) +inline void RemoveObjectMessage( UpdateManager& manager, const PropertyOwner* object ) { typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ) @@ -791,7 +875,7 @@ inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGrap typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::Animation > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddAnimation, animation ); @@ -805,7 +889,7 @@ inline void StopAnimationMessage( UpdateManager& manager, const Animation& const typedef MessageValue1< UpdateManager, Animation* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::StopAnimation, &animation ); @@ -819,19 +903,44 @@ inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& con typedef MessageValue1< UpdateManager, Animation* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::RemoveAnimation, &animation ); } +inline void AddRenderTaskListMessage( UpdateManager& manager, OwnerPointer< SceneGraph::RenderTaskList >& taskList ) +{ + typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::RenderTaskList > > LocalType; + + // 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 ); + + typedef MessageValue1< UpdateManager, RenderTaskList* > LocalType; + + // 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 AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification ) { // Message has ownership of PropertyNotification while in transit from event -> update typedef MessageValue1< UpdateManager, OwnerPointer< PropertyNotification > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddPropertyNotification, propertyNotification ); @@ -845,7 +954,7 @@ inline void RemovePropertyNotificationMessage( UpdateManager& manager, const Pro typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::RemovePropertyNotification, &propertyNotification ); @@ -861,7 +970,7 @@ inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager, typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::PropertyNotificationSetNotify, propertyNotification, notifyMode ); @@ -873,36 +982,36 @@ inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& sh typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddShader, shader ); } // 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; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ) @@ -910,49 +1019,71 @@ inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& co typedef MessageValue1< UpdateManager, Vector4 > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ); } -inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect& rect ) +inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect& rect ) { - typedef MessageValue1< UpdateManager, Rect > LocalType; + typedef MessageValue1< UpdateManager, Rect > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ); } +inline void SetDefaultSurfaceOrientationMessage( UpdateManager& manager, int orientation ) +{ + typedef MessageValue1< UpdateManager, int > LocalType; + + // 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; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::KeepRendering, durationSeconds ); } +inline void SetRenderingBehaviorMessage( UpdateManager& manager, DevelStage::Rendering renderingBehavior ) +{ + typedef MessageValue1< UpdateManager, DevelStage::Rendering > LocalType; + + // 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::SetRenderingBehavior, renderingBehavior ); +} + /** * 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; + typedef MessageValue2< UpdateManager, std::vector< Layer* >, const Layer* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ) @@ -960,19 +1091,19 @@ inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer > typedef MessageValue1< UpdateManager, OwnerPointer< Renderer > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddRenderer, object ); } -inline void RemoveRendererMessage( UpdateManager& manager, Renderer& object ) +inline void RemoveRendererMessage( UpdateManager& manager, const Renderer& object ) { typedef MessageValue1< UpdateManager, Renderer* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 @@ -981,7 +1112,7 @@ inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureS typedef MessageValue1< UpdateManager, OwnerPointer< TextureSet > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddTextureSet, textureSet ); @@ -993,7 +1124,7 @@ inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& texture typedef MessageValue1< UpdateManager, TextureSet* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::RemoveTextureSet, &textureSet ); @@ -1005,7 +1136,7 @@ inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sam typedef MessageValue1< UpdateManager, OwnerPointer< Render::Sampler > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddSampler, sampler ); @@ -1016,29 +1147,29 @@ inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampl typedef MessageValue1< UpdateManager, Render::Sampler* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::RemoveSampler, &sampler ); } -inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, unsigned int minFilterMode, unsigned int magFilterMode ) +inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode ) { - typedef MessageValue3< UpdateManager, Render::Sampler*, unsigned int, unsigned int > LocalType; + typedef MessageValue3< UpdateManager, Render::Sampler*, uint32_t, uint32_t > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::SetFilterMode, &sampler, minFilterMode, magFilterMode ); } -inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode ) +inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode ) { - typedef MessageValue4< UpdateManager, Render::Sampler*, unsigned int, unsigned int, unsigned int > LocalType; + typedef MessageValue4< UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode ); @@ -1050,7 +1181,7 @@ inline void AddPropertyBuffer( UpdateManager& manager, OwnerPointer< Render::Pro typedef MessageValue1< UpdateManager, OwnerPointer< Render::PropertyBuffer > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ); @@ -1061,7 +1192,7 @@ inline void RemovePropertyBuffer( UpdateManager& manager, Render::PropertyBuffer typedef MessageValue1< UpdateManager, Render::PropertyBuffer* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ); @@ -1073,19 +1204,19 @@ inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuf typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format> > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ); } -inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector >& data, size_t size ) +inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, 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 >, size_t > LocalType; + typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector >, uint32_t > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ); @@ -1097,7 +1228,7 @@ inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry typedef MessageValue1< UpdateManager, OwnerPointer< Render::Geometry > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddGeometry, geometry ); @@ -1108,7 +1239,7 @@ inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry ) typedef MessageValue1< UpdateManager, Render::Geometry* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::RemoveGeometry, &geometry ); @@ -1119,7 +1250,7 @@ inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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) ); @@ -1130,7 +1261,7 @@ inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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) ); @@ -1145,7 +1276,7 @@ public: /** * Constructor which does a Vector::Swap() */ - IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector& indices ) + IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector& indices ) : MessageBase(), mManager( manager ), mRenderGeometry( geometry ) @@ -1173,26 +1304,26 @@ private: T* mManager; Render::Geometry* mRenderGeometry; - Dali::Vector mIndices; + Dali::Vector mIndices; }; -inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector& indices ) +inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector& indices ) { typedef IndexBufferMessage< UpdateManager > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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, &geometry, indices ); } -inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, unsigned int geometryType ) +inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType ) { - typedef MessageValue2< UpdateManager, Render::Geometry*, unsigned int > LocalType; + typedef MessageValue2< UpdateManager, Render::Geometry*, uint32_t > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::SetGeometryType, &geometry, geometryType ); @@ -1204,7 +1335,7 @@ inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& typedef MessageValue1< UpdateManager, OwnerPointer< Render::Texture > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AddTexture, texture ); @@ -1215,7 +1346,7 @@ inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture ) typedef MessageValue1< UpdateManager, Render::Texture* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::RemoveTexture, &texture ); @@ -1226,7 +1357,7 @@ inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& textu typedef MessageValue3< UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::UploadTexture, &texture, pixelData, params ); @@ -1237,22 +1368,22 @@ inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& tex typedef MessageValue1< UpdateManager, Render::Texture* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::GenerateMipmaps, &texture ); } -inline void AddFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer ) +inline void AddFrameBuffer( UpdateManager& manager, OwnerPointer< Render::FrameBuffer >& frameBuffer ) { - typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType; + typedef MessageValue1< UpdateManager, OwnerPointer< Render::FrameBuffer > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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 ) @@ -1260,18 +1391,18 @@ inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& fram typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::RemoveFrameBuffer, &frameBuffer ); } -inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer ) +inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer ) { - typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::Texture*, unsigned int, unsigned int > LocalType; + typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer ); @@ -1282,12 +1413,45 @@ inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDe typedef MessageValue1< UpdateManager, OwnerPointer< NodeDepths > > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); + 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::SetDepthIndices, nodeDepths ); } +inline void AddResetterMessage( UpdateManager& manager, OwnerPointer resetter ) +{ + typedef MessageValue1< UpdateManager, OwnerPointer > LocalType; + + // 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::AddPropertyResetter, resetter ); +} + +inline void AddFrameCallbackMessage( UpdateManager& manager, OwnerPointer< FrameCallback >& frameCallback, const Node& rootNode ) +{ + typedef MessageValue2< UpdateManager, OwnerPointer< FrameCallback >, const Node* > LocalType; + + // 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 ); +} + +inline void RemoveFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback ) +{ + typedef MessageValue1< UpdateManager, FrameCallbackInterface* > LocalType; + + // 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::RemoveFrameCallback, &frameCallback ); +} + } // namespace SceneGraph } // namespace Internal