Remove uniform hash
[platform/core/uifw/dali-core.git] / dali / internal / update / rendering / scene-graph-renderer.h
old mode 100755 (executable)
new mode 100644 (file)
index 508b4af..1886342
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  * limitations under the License.
  */
 
-#include <dali/public-api/rendering/geometry.h>
-#include <dali/public-api/rendering/renderer.h> // Dali::Renderer
 #include <dali/devel-api/rendering/renderer-devel.h>
 #include <dali/internal/common/blending-options.h>
-#include <dali/internal/common/type-abstraction-enums.h>
+#include <dali/internal/common/memory-pool-key.h>
 #include <dali/internal/event/common/event-thread-services.h>
-#include <dali/internal/update/common/property-owner.h>
-#include <dali/internal/update/common/uniform-map.h>
-#include <dali/internal/update/common/scene-graph-connection-change-propagator.h>
-#include <dali/internal/update/common/animatable-property.h>
 #include <dali/internal/render/data-providers/render-data-provider.h>
 #include <dali/internal/render/renderers/render-renderer.h>
+#include <dali/internal/update/common/animatable-property.h>
+#include <dali/internal/update/common/property-owner.h>
+#include <dali/internal/update/common/uniform-map.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h> // Dali::Renderer
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace Render
 {
 class Renderer;
 class Geometry;
-}
+} // namespace Render
 
 namespace SceneGraph
 {
 class SceneController;
 
 class Renderer;
-typedef Dali::Vector< Renderer* > RendererContainer;
-typedef RendererContainer::Iterator RendererIter;
-typedef RendererContainer::ConstIterator RendererConstIter;
-
 class TextureSet;
 class Geometry;
 
-class Renderer :  public PropertyOwner,
-                  public UniformMapDataProvider,
-                  public UniformMap::Observer,
-                  public ConnectionChangePropagator::Observer
+using RendererKey = MemoryPoolKey<SceneGraph::Renderer>;
+
+} // namespace SceneGraph
+} // namespace Internal
+
+// Ensure RendererKey can be used in Dali::Vector
+template<>
+struct TypeTraits<Internal::SceneGraph::RendererKey> : public BasicTypes<Internal::SceneGraph::RendererKey>
 {
-public:
+  enum
+  {
+    IS_TRIVIAL_TYPE = true
+  };
+};
+
+namespace Internal
+{
+namespace SceneGraph
+{
+using RendererContainer = Dali::Vector<RendererKey>;
+using RendererIter      = RendererContainer::Iterator;
+using RendererConstIter = RendererContainer::ConstIterator;
+
+namespace VisualRenderer
+{
+struct AnimatableVisualProperties
+{
+  AnimatableVisualProperties()
+  : mTransformOffset(Vector2::ZERO),
+    mTransformSize(Vector2::ONE),
+    mTransformOrigin(Vector2::ZERO),
+    mTransformAnchorPoint(Vector2::ZERO),
+    mTransformOffsetSizeMode(Vector4::ZERO),
+    mExtraSize(Vector2::ZERO),
+    mMixColor(Vector3::ONE),
+    mPreMultipliedAlpha(0.0f),
+    mExtendedPropertiesDeleteFunction(nullptr)
+  {
+  }
+
+  ~AnimatableVisualProperties()
+  {
+    if(mExtendedProperties && mExtendedPropertiesDeleteFunction)
+    {
+      mExtendedPropertiesDeleteFunction(mExtendedProperties);
+    }
+  }
+
+  /**
+   * @brief Cached coefficient value when we calculate visual transformed update size.
+   * It can reduce complexity of calculate the vertex position.
+   *
+   * Vector2 vertexPosition = (XA * aPosition + XB) * originalSize + (CA * aPosition + CB) + Vector2(D, D) * aPosition
+   */
+  struct VisualTransformedUpdateSizeCoefficientCache
+  {
+    Vector2 coefXA{Vector2::ZERO};
+    Vector2 coefXB{Vector2::ZERO};
+    Vector2 coefCA{Vector2::ZERO};
+    Vector2 coefCB{Vector2::ZERO};
+    float   coefD{0.0f};
+
+    uint64_t hash{0u};
+    uint64_t decoratedHash{0u};
+  };
+  VisualTransformedUpdateSizeCoefficientCache mCoefficient; ///< Coefficient value to calculate visual transformed update size by VisualProperties more faster.
+
+  AnimatableProperty<Vector2> mTransformOffset;
+  AnimatableProperty<Vector2> mTransformSize;
+  AnimatableProperty<Vector2> mTransformOrigin;
+  AnimatableProperty<Vector2> mTransformAnchorPoint;
+  AnimatableProperty<Vector4> mTransformOffsetSizeMode;
+  AnimatableProperty<Vector2> mExtraSize;
+  AnimatableProperty<Vector3> mMixColor;
+  AnimatableProperty<float>   mPreMultipliedAlpha;
+
+  void* mExtendedProperties{nullptr};                        // Enable derived class to extend properties further
+  void (*mExtendedPropertiesDeleteFunction)(void*){nullptr}; // Derived class's custom delete functor
+};
+
+struct AnimatableDecoratedVisualProperties
+{
+  AnimatableDecoratedVisualProperties()
+  : mCornerRadius(Vector4::ZERO),
+    mCornerRadiusPolicy(1.0f),
+    mBorderlineWidth(0.0f),
+    mBorderlineColor(Color::BLACK),
+    mBorderlineOffset(0.0f),
+    mBlurRadius(0.0f)
+  {
+  }
+  ~AnimatableDecoratedVisualProperties()
+  {
+  }
+
+  // Delete function of AnimatableDecoratedVisualProperties* converted as void*
+  static void DeleteFunction(void* data)
+  {
+    delete static_cast<AnimatableDecoratedVisualProperties*>(data);
+  }
+
+  AnimatableProperty<Vector4> mCornerRadius;
+  AnimatableProperty<float>   mCornerRadiusPolicy;
+  AnimatableProperty<float>   mBorderlineWidth;
+  AnimatableProperty<Vector4> mBorderlineColor;
+  AnimatableProperty<float>   mBorderlineOffset;
+  AnimatableProperty<float>   mBlurRadius;
+};
+} // namespace VisualRenderer
 
+class Renderer : public PropertyOwner,
+                 public UniformMapDataProvider,
+                 public RenderDataProvider
+{
+public:
   enum OpacityType
   {
     OPAQUE,
@@ -71,45 +172,75 @@ public:
   /**
    * Construct a new Renderer
    */
-  static Renderer* New();
+  static RendererKey NewKey();
 
   /**
    * Destructor
    */
-  virtual ~Renderer();
+  ~Renderer() override;
 
   /**
    * Overriden delete operator
    * Deletes the renderer from its global memory pool
    */
-  void operator delete( void* ptr );
+  void operator delete(void* ptr);
+
+  /**
+   * Get a pointer to the object from the given key.
+   * Used by MemoryPoolKey to provide pointer semantics.
+   */
+  static Renderer* Get(RendererKey::KeyType);
+
+  /**
+   * Get the key of the given renderer in the associated memory pool.
+   * @param[in] renderer the given renderer
+   * @return The key in the associated memory pool.
+   */
+  static RendererKey GetKey(const SceneGraph::Renderer& renderer);
+
+  /**
+   * Get the key of the given renderer in the associated memory pool.
+   * @param[in] renderer the given renderer
+   * @return The key in the associated memory pool, or -1 if not
+   * found.
+   */
+  static RendererKey GetKey(SceneGraph::Renderer* renderer);
 
   /**
    * Set the texture set for the renderer
    * @param[in] textureSet The texture set this renderer will use
    */
-  void SetTextures( TextureSet* textureSet );
+  void SetTextures(TextureSet* textureSet);
 
   /**
-   * Returns current texture set object
-   * @return Pointer to the texture set
+   * Get the associated texture set
+   * @return the texture set.
    */
-  const TextureSet* GetTextures() const
+  const SceneGraph::TextureSet* GetTextureSet() const
   {
     return mTextureSet;
   }
 
   /**
+   * @copydoc RenderDataProvider::GetTextures()
+   */
+  const Vector<Render::TextureKey>* GetTextures() const override;
+
+  /**
+   * @copydoc RenderDataProvider::GetSamplers()
+   */
+  const Vector<Render::Sampler*>* GetSamplers() const override;
+
+  /**
    * Set the shader for the renderer
    * @param[in] shader The shader this renderer will use
    */
-  void SetShader( Shader* shader );
+  void SetShader(Shader* shader);
 
   /**
-   * Get the shader used by this renderer
-   * @return the shader this renderer uses
+   * @copydoc RenderDataProvider::GetShader()
    */
-  const Shader& GetShader() const
+  const Shader& GetShader() const override
   {
     return *mShader;
   }
@@ -118,13 +249,13 @@ public:
    * Set the geometry for the renderer
    * @param[in] geometry The geometry this renderer will use
    */
-  void SetGeometry( Render::Geometry* geometry );
+  void SetGeometry(Render::Geometry* geometry);
 
   /**
    * Set the depth index
    * @param[in] depthIndex the new depth index to use
    */
-  void SetDepthIndex( int depthIndex );
+  void SetDepthIndex(int depthIndex);
 
   /**
    * @brief Get the depth index
@@ -139,7 +270,7 @@ public:
    * Set the face culling mode
    * @param[in] faceCullingMode to use
    */
-  void SetFaceCullingMode( FaceCullingMode::Type faceCullingMode );
+  void SetFaceCullingMode(FaceCullingMode::Type faceCullingMode);
 
   /**
    * Get face culling mode
@@ -151,7 +282,7 @@ public:
    * Set the blending mode
    * @param[in] blendingMode to use
    */
-  void SetBlendMode( BlendMode::Type blendingMode );
+  void SetBlendMode(BlendMode::Type blendingMode);
 
   /**
    * Get the blending mode
@@ -163,7 +294,7 @@ public:
    * Set the blending options. This should only be called from the update thread.
    * @param[in] options A bitmask of blending options.
    */
-  void SetBlendingOptions( uint32_t options );
+  void SetBlendingOptions(uint32_t options);
 
   /**
    * Get the blending options
@@ -175,7 +306,7 @@ public:
    * Set the blend color for blending operation
    * @param blendColor to pass to GL
    */
-  void SetBlendColor( const Vector4& blendColor );
+  void SetBlendColor(const Vector4& blendColor);
 
   /**
    * Get the blending color
@@ -187,7 +318,7 @@ public:
    * Set the index of first element for indexed draw
    * @param[in] firstElement index of first element to draw
    */
-  void SetIndexedDrawFirstElement( uint32_t firstElement );
+  void SetIndexedDrawFirstElement(uint32_t firstElement);
 
   /**
    * Get the index of first element for indexed draw
@@ -199,7 +330,7 @@ public:
    * Set the number of elements to draw by indexed draw
    * @param[in] elementsCount number of elements to draw
    */
-  void SetIndexedDrawElementsCount( uint32_t elementsCount );
+  void SetIndexedDrawElementsCount(uint32_t elementsCount);
 
   /**
    * Get the number of elements to draw by indexed draw
@@ -211,7 +342,7 @@ public:
    * @brief Set whether the Pre-multiplied Alpha Blending is required
    * @param[in] preMultipled whether alpha is pre-multiplied.
    */
-  void EnablePreMultipliedAlpha( bool preMultipled );
+  void EnablePreMultipliedAlpha(bool preMultipled);
 
   /**
    * @brief Query whether alpha is pre-multiplied.
@@ -223,7 +354,7 @@ public:
    * Sets the depth buffer write mode
    * @param[in] depthWriteMode The depth buffer write mode
    */
-  void SetDepthWriteMode( DepthWriteMode::Type depthWriteMode );
+  void SetDepthWriteMode(DepthWriteMode::Type depthWriteMode);
 
   /**
    * Get the depth buffer write mode
@@ -235,7 +366,7 @@ public:
    * Sets the depth buffer test mode
    * @param[in] depthTestMode The depth buffer test mode
    */
-  void SetDepthTestMode( DepthTestMode::Type depthTestMode );
+  void SetDepthTestMode(DepthTestMode::Type depthTestMode);
 
   /**
    * Get the depth buffer test mode
@@ -247,7 +378,7 @@ public:
    * Sets the depth function
    * @param[in] depthFunction The depth function
    */
-  void SetDepthFunction( DepthFunction::Type depthFunction );
+  void SetDepthFunction(DepthFunction::Type depthFunction);
 
   /**
    * Get the depth function
@@ -259,49 +390,49 @@ public:
    * Sets the render mode
    * @param[in] mode The render mode
    */
-  void SetRenderMode( RenderMode::Type mode );
+  void SetRenderMode(RenderMode::Type mode);
 
   /**
    * Sets the stencil function
    * @param[in] stencilFunction The stencil function
    */
-  void SetStencilFunction( StencilFunction::Type stencilFunction );
+  void SetStencilFunction(StencilFunction::Type stencilFunction);
 
   /**
    * Sets the stencil function mask
    * @param[in] stencilFunctionMask The stencil function mask
    */
-  void SetStencilFunctionMask( int stencilFunctionMask );
+  void SetStencilFunctionMask(int stencilFunctionMask);
 
   /**
    * Sets the stencil function reference
    * @param[in] stencilFunctionReference The stencil function reference
    */
-  void SetStencilFunctionReference( int stencilFunctionReference );
+  void SetStencilFunctionReference(int stencilFunctionReference);
 
   /**
    * Sets the stencil mask
    * @param[in] stencilMask The stencil mask
    */
-  void SetStencilMask( int stencilMask );
+  void SetStencilMask(int stencilMask);
 
   /**
    * Sets the stencil operation for when the stencil test fails
    * @param[in] stencilOperationOnFail The stencil operation
    */
-  void SetStencilOperationOnFail( StencilOperation::Type stencilOperationOnFail );
+  void SetStencilOperationOnFail(StencilOperation::Type stencilOperationOnFail);
 
   /**
    * Sets the stencil operation for when the depth test fails
    * @param[in] stencilOperationOnZFail The stencil operation
    */
-  void SetStencilOperationOnZFail( StencilOperation::Type stencilOperationOnZFail );
+  void SetStencilOperationOnZFail(StencilOperation::Type stencilOperationOnZFail);
 
   /**
    * Sets the stencil operation for when the depth test passes
    * @param[in] stencilOperationOnZPass The stencil operation
    */
-  void SetStencilOperationOnZPass( StencilOperation::Type stencilOperationOnZPass );
+  void SetStencilOperationOnZPass(StencilOperation::Type stencilOperationOnZPass);
 
   /**
    * Gets the stencil parameters
@@ -314,20 +445,18 @@ public:
    * @param[in] updateBufferIndex The current update buffer index.
    * @param[in] opacity The opacity
    */
-  void BakeOpacity( BufferIndex updateBufferIndex, float opacity );
+  void BakeOpacity(BufferIndex updateBufferIndex, float opacity);
 
   /**
-   * Gets the opacity
-   * @param[in] bufferIndex The buffer to read from.
-   * @return The opacity
+   * @copydoc RenderDataProvider::GetOpacity()
    */
-  float GetOpacity( BufferIndex updateBufferIndex ) const;
+  float GetOpacity(BufferIndex updateBufferIndex) const override;
 
   /**
    * Sets the rendering behavior
    * @param[in] renderingBehavior The rendering behavior required.
    */
-  void SetRenderingBehavior( DevelRenderer::Rendering::Type renderingBehavior );
+  void SetRenderingBehavior(DevelRenderer::Rendering::Type renderingBehavior);
 
   /**
    * Gets the rendering behavior
@@ -339,31 +468,22 @@ public:
    * Prepare the object for rendering.
    * This is called by the UpdateManager when an object is due to be rendered in the current frame.
    * @param[in] updateBufferIndex The current update buffer index.
+   * @return Whether this renderer has been updated in the current frame
    */
-  void PrepareRender( BufferIndex updateBufferIndex );
+  bool PrepareRender(BufferIndex updateBufferIndex);
 
   /**
    * Retrieve the Render thread renderer
    * @return The associated render thread renderer
    */
-  Render::Renderer& GetRenderer();
+  Render::RendererKey GetRenderer();
 
   /**
    * Query whether the renderer is fully opaque, fully transparent or transparent.
    * @param[in] updateBufferIndex The current update buffer index.
    * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
    */
-  OpacityType GetOpacityType( BufferIndex updateBufferIndex, const Node& node ) const;
-
-  /**
-   * Called by the TextureSet to notify to the renderer that it has changed
-   */
-  void TextureSetChanged();
-
-  /**
-   * Called by the TextureSet to notify to the renderer that it is about to be deleted
-   */
-  void TextureSetDeleted();
+  OpacityType GetOpacityType(BufferIndex updateBufferIndex, const Node& node) const;
 
   /**
    * Connect the object to the scene graph
@@ -371,363 +491,174 @@ public:
    * @param[in] sceneController The scene controller - used for sending messages to render thread
    * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
    */
-  void ConnectToSceneGraph( SceneController& sceneController, BufferIndex bufferIndex );
+  void ConnectToSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
 
   /**
    * Disconnect the object from the scene graph
    * @param[in] sceneController The scene controller - used for sending messages to render thread
    * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
    */
-  void DisconnectFromSceneGraph( SceneController& sceneController, BufferIndex bufferIndex );
+  void DisconnectFromSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
 
-public: // Implementation of ConnectionChangePropagator
   /**
-   * @copydoc ConnectionChangePropagator::AddObserver
+   * @copydoc RenderDataProvider::GetUniformMapDataProvider()
    */
-  void AddConnectionObserver(ConnectionChangePropagator::Observer& observer){};
+  const UniformMapDataProvider& GetUniformMapDataProvider() const override
+  {
+    return *this;
+  };
 
   /**
-   * @copydoc ConnectionChangePropagator::RemoveObserver
+   * @copydoc RenderDataProvider::IsUpdated()
    */
-  void RemoveConnectionObserver(ConnectionChangePropagator::Observer& observer){};
+  bool IsUpdated() const override;
 
-public: // UniformMap::Observer
   /**
-   * @copydoc UniformMap::Observer::UniformMappingsChanged
+   * @copydoc RenderDataProvider::GetVisualTransformedUpdateArea()
    */
-  virtual void UniformMappingsChanged( const UniformMap& mappings );
+  Vector4 GetVisualTransformedUpdateArea(BufferIndex updateBufferIndex, const Vector4& originalUpdateArea) noexcept override;
 
-public: // ConnectionChangePropagator::Observer
+  /**
+   * Sets RenderCallback object
+   *
+   * @param[in] callback Valid pointer to RenderCallback object
+   */
+  void SetRenderCallback(RenderCallback* callback);
 
   /**
-   * @copydoc ConnectionChangePropagator::ConnectionsChanged
+   * Returns currently set RenderCallback pointer
+   *
+   * @return RenderCallback pointer or nullptr
    */
-  virtual void ConnectionsChanged( PropertyOwner& owner );
+  RenderCallback* GetRenderCallback()
+  {
+    return mRenderCallback;
+  }
 
   /**
-   * @copydoc ConnectionChangePropagator::ConnectedUniformMapChanged
+   * Merge shader uniform map into renderer uniform map if any of the
+   * maps have changed.  Only update uniform map if added to render
+   * instructions.
+   * @param[in] updateBufferIndex The current update buffer index.
    */
-  virtual void ConnectedUniformMapChanged( );
+  void UpdateUniformMap(BufferIndex updateBufferIndex);
 
   /**
-   * @copydoc ConnectionChangePropagator::ConnectedUniformMapChanged
+   * Set the given external draw commands on this renderer.
    */
-  virtual void ObservedObjectDestroyed(PropertyOwner& owner);
+  void SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size);
+
+  /**
+   * Query whether a renderer is dirty.
+   * @return true if the renderer is dirty.
+   * @note It is used to decide whether to reuse the RenderList. We can't reuse the RenderList if this is dirty.
+   */
+  bool IsDirty() const;
+
+  /**
+   * Reset both dirty flag and updated flag.
+   * @note This is called after rendering has completed.
+   */
+  void ResetDirtyFlag();
+
+  /**
+   * Get the capacity of the memory pools
+   * @return the capacity of the memory pools
+   */
+  static uint32_t GetMemoryPoolCapacity();
+
+public: // PropertyOwner::MappingChanged
+  /**
+   * @copydoc PropertyOwner::OnMappingChanged
+   */
+  void OnMappingChanged() override;
 
 public: // PropertyOwner implementation
   /**
    * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
    */
-  virtual void ResetDefaultProperties( BufferIndex updateBufferIndex ){};
+  virtual void ResetDefaultProperties(BufferIndex updateBufferIndex){};
 
 public: // From UniformMapDataProvider
+  /**
+   * @copydoc UniformMapDataProvider::GetCollectedUniformMap
+   */
+  const CollectedUniformMap& GetCollectedUniformMap() const override;
 
+public: // For VisualProperties
   /**
-   * @copydoc UniformMapDataProvider::GetUniformMapChanged
+   * To be used only for 1st stage initialization in event thread.
    */
-  virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const{ return mUniformMapChanged[bufferIndex];}
+  void SetVisualProperties(VisualRenderer::AnimatableVisualProperties* visualProperties)
+  {
+    mVisualProperties = visualProperties;
+  }
 
   /**
-   * @copydoc UniformMapDataProvider::GetUniformMap
+   * May be accessed from event thread
    */
-  virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const;
+  const VisualRenderer::AnimatableVisualProperties* GetVisualProperties() const
+  {
+    return mVisualProperties.Get();
+  }
 
 private:
-
   /**
    * Protected constructor; See also Renderer::New()
    */
   Renderer();
 
-  /**
-   * Update texture set to the render data provider
-   */
-  void UpdateTextureSet();
-
 private:
+  enum Decay
+  {
+    DONE    = 0,
+    LAST    = 1,
+    INITIAL = 2
+  };
 
-  CollectedUniformMap          mCollectedUniformMap[2];           ///< Uniform maps collected by the renderer
-
-  SceneController*             mSceneController;                  ///< Used for initializing renderers
-  Render::Renderer*            mRenderer;                         ///< Raw pointer to the renderer (that's owned by RenderManager)
-  TextureSet*                  mTextureSet;                       ///< The texture set this renderer uses. (Not owned)
-  Render::Geometry*            mGeometry;                         ///< The geometry this renderer uses. (Not owned)
-  Shader*                      mShader;                           ///< The shader this renderer uses. (Not owned)
-  RenderDataProvider*          mRenderDataProvider;               ///< The render data provider
-  OwnerPointer< Vector4 >      mBlendColor;                       ///< The blend color for blending operation
-
-  Dali::Internal::Render::Renderer::StencilParameters mStencilParameters;         ///< Struct containing all stencil related options
-
-  uint32_t                     mIndexedDrawFirstElement;          ///< first element index to be drawn using indexed draw
-  uint32_t                     mIndexedDrawElementsCount;         ///< number of elements to be drawn using indexed draw
-  uint32_t                     mBlendBitmask;                     ///< The bitmask of blending options
-  uint32_t                     mRegenerateUniformMap;             ///< 2 if the map should be regenerated, 1 if it should be copied.
-  uint32_t                     mResendFlag;                       ///< Indicate whether data should be resent to the renderer
-
-  DepthFunction::Type          mDepthFunction:4;                  ///< Local copy of the depth function
-  FaceCullingMode::Type        mFaceCullingMode:3;                ///< Local copy of the mode of face culling
-  BlendMode::Type              mBlendMode:3;                      ///< Local copy of the mode of blending
-  DepthWriteMode::Type         mDepthWriteMode:3;                 ///< Local copy of the depth write mode
-  DepthTestMode::Type          mDepthTestMode:3;                  ///< Local copy of the depth test mode
-  DevelRenderer::Rendering::Type mRenderingBehavior:2;            ///< The rendering behavior
-  bool                         mUniformMapChanged[2];             ///< Records if the uniform map has been altered this frame
-  bool                         mPremultipledAlphaEnabled:1;       ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
-
-public:
-
-  AnimatableProperty< float >  mOpacity;                          ///< The opacity value
-  int32_t                      mDepthIndex;                       ///< Used only in PrepareRenderInstructions
-
-};
-
-
-/// Messages
-inline void SetTexturesMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet )
-{
-  typedef MessageValue1< Renderer, TextureSet* > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &renderer, &Renderer::SetTextures, const_cast<TextureSet*>(&textureSet) );
-}
-
-inline void SetGeometryMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry )
-{
-  typedef MessageValue1< Renderer, Render::Geometry* > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry) );
-}
-
-inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const Shader& shader )
-{
-  typedef MessageValue1< Renderer, Shader* > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &renderer, &Renderer::SetShader, const_cast<Shader*>( &shader ) );
-}
-
-inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex )
-{
-  typedef MessageValue1< Renderer, int > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &renderer, &Renderer::SetDepthIndex, depthIndex );
-}
-
-inline void SetFaceCullingModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode )
-{
-  typedef MessageValue1< Renderer, FaceCullingMode::Type > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetFaceCullingMode, faceCullingMode );
-}
-
-inline void SetBlendModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode )
-{
-  typedef MessageValue1< Renderer, BlendMode::Type > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetBlendMode, blendingMode );
-}
-
-inline void SetBlendingOptionsMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t options )
-{
-  typedef MessageValue1< Renderer, uint32_t > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetBlendingOptions, options );
-}
-
-inline void SetBlendColorMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor )
-{
-  typedef MessageValue1< Renderer, Vector4 > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetBlendColor, blendColor );
-}
-
-inline void SetIndexedDrawFirstElementMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t firstElement )
-{
-  typedef MessageValue1< Renderer, uint32_t > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetIndexedDrawFirstElement, firstElement );
-}
-
-inline void SetIndexedDrawElementsCountMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t elementsCount )
-{
-  typedef MessageValue1< Renderer, uint32_t > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount );
-}
-
-inline void SetEnablePreMultipliedAlphaMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied )
-{
-  typedef MessageValue1< Renderer, bool > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied );
-}
-
-inline void SetDepthWriteModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode )
-{
-  typedef MessageValue1< Renderer, DepthWriteMode::Type > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetDepthWriteMode, depthWriteMode );
-}
-
-inline void SetDepthTestModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode )
-{
-  typedef MessageValue1< Renderer, DepthTestMode::Type > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetDepthTestMode, depthTestMode );
-}
-
-inline void SetDepthFunctionMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction )
-{
-  typedef MessageValue1< Renderer, DepthFunction::Type > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetDepthFunction, depthFunction );
-}
-
-inline void SetRenderModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode )
-{
-  typedef MessageValue1< Renderer, RenderMode::Type > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetRenderMode, mode );
-}
-
-inline void SetStencilFunctionMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction )
-{
-  typedef MessageValue1< Renderer, StencilFunction::Type > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetStencilFunction, stencilFunction );
-}
-
-inline void SetStencilFunctionMaskMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int mask )
-{
-  typedef MessageValue1< Renderer, int > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetStencilFunctionMask, mask );
-}
-
-inline void SetStencilFunctionReferenceMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference )
-{
-  typedef MessageValue1< Renderer, int > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference );
-}
-
-inline void SetStencilMaskMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask )
-{
-  typedef MessageValue1< Renderer, int > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetStencilMask, stencilMask );
-}
-
-inline void SetStencilOperationOnFailMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation )
-{
-  typedef MessageValue1< Renderer, StencilOperation::Type > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnFail, stencilOperation );
-}
-
-inline void SetStencilOperationOnZFailMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation )
-{
-  typedef MessageValue1< Renderer, StencilOperation::Type > LocalType;
-
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation );
-}
-
-inline void SetStencilOperationOnZPassMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation )
-{
-  typedef MessageValue1< Renderer, StencilOperation::Type > LocalType;
+private:
+  CollectedUniformMap mCollectedUniformMap; ///< Uniform maps collected by the renderer
 
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  SceneController*    mSceneController; ///< Used for initializing renderers
+  Render::RendererKey mRenderer;        ///< Key to the renderer (that's owned by RenderManager)
+  TextureSet*         mTextureSet;      ///< The texture set this renderer uses. (Not owned)
+  Render::Geometry*   mGeometry;        ///< The geometry this renderer uses. (Not owned)
+  Shader*             mShader;          ///< The shader this renderer uses. (Not owned)
 
-  new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation );
-}
+  OwnerPointer<VisualRenderer::AnimatableVisualProperties> mVisualProperties{nullptr}; ///< VisualProperties (optional/owned)
+  OwnerPointer<Vector4>                                    mBlendColor;                ///< The blend color for blending operation
 
-inline void BakeOpacityMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity )
-{
-  typedef MessageDoubleBuffered1< Renderer, float > LocalType;
+  Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
 
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t             mIndexedDrawFirstElement;     ///< first element index to be drawn using indexed draw
+  uint32_t             mIndexedDrawElementsCount;    ///< number of elements to be drawn using indexed draw
+  uint32_t             mBlendBitmask;                ///< The bitmask of blending options
+  uint32_t             mResendFlag;                  ///< Indicate whether data should be resent to the renderer
+  UniformMap::SizeType mUniformMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
+  UniformMap::SizeType mShaderMapChangeCounter{0u};  ///< Value to check if uniform data should be updated
 
-  new (slot) LocalType( &renderer, &Renderer::BakeOpacity, opacity );
-}
+  DepthFunction::Type            mDepthFunction : 4;     ///< Local copy of the depth function
+  FaceCullingMode::Type          mFaceCullingMode : 3;   ///< Local copy of the mode of face culling
+  BlendMode::Type                mBlendMode : 3;         ///< Local copy of the mode of blending
+  DepthWriteMode::Type           mDepthWriteMode : 3;    ///< Local copy of the depth write mode
+  DepthTestMode::Type            mDepthTestMode : 3;     ///< Local copy of the depth test mode
+  DevelRenderer::Rendering::Type mRenderingBehavior : 2; ///< The rendering behavior
+  Decay                          mUpdateDecay : 2;       ///< Update decay (aging)
 
-inline void SetRenderingBehaviorMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DevelRenderer::Rendering::Type renderingBehavior )
-{
-  using LocalType = MessageValue1< Renderer, DevelRenderer::Rendering::Type >;
+  bool mRegenerateUniformMap : 1;     ///< true if the map should be regenerated
+  bool mPremultipledAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
+  bool mDirtyFlag : 1;                ///< Flag indicating whether the properties are changed
 
-  // Reserve some memory inside the message queue
-  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  std::vector<Dali::DevelRenderer::DrawCommand> mDrawCommands;
+  Dali::RenderCallback*                         mRenderCallback{nullptr};
 
-  new (slot) LocalType( &renderer, &Renderer::SetRenderingBehavior, renderingBehavior );
-}
+public:
+  AnimatableProperty<float> mOpacity;    ///< The opacity value
+  int32_t                   mDepthIndex; ///< Used only in PrepareRenderInstructions
+};
 
 } // namespace SceneGraph
 } // namespace Internal
 } // namespace Dali
 
-#endif //  DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
+#endif // DALI_INTERNAL_SCENE_GRAPH_RENDERER_H