[dali_1.2.38] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / internal / update / rendering / scene-graph-renderer.h
index 1a86cb9..b150ee3 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -30,6 +30,7 @@
 
 namespace Dali
 {
+
 namespace Internal
 {
 
@@ -118,15 +119,6 @@ public:
   void SetGeometry( Render::Geometry* geometry );
 
   /**
-   * Get the geometry of this renderer
-   * @return the geometry this renderer uses
-   */
-  const Render::Geometry& GetGeometry() const
-  {
-    return *mGeometry;
-  }
-
-  /**
    * Set the depth index
    * @param[in] depthIndex the new depth index to use
    */
@@ -202,10 +194,10 @@ public:
   void SetDepthFunction( DepthFunction::Type depthFunction );
 
   /**
-   * Sets the stencil mode
-   * @param[in] mode The stencil function
+   * Sets the render mode
+   * @param[in] mode The render mode
    */
-  void SetStencilMode( StencilMode::Type mode );
+  void SetRenderMode( RenderMode::Type mode );
 
   /**
    * Sets the stencil function
@@ -250,27 +242,6 @@ public:
   void SetStencilOperationOnZPass( StencilOperation::Type stencilOperationOnZPass );
 
   /**
-   * Sets whether or not to write to the color buffer
-   * @param[in] writeToColorBuffer True to write to the color buffer
-   */
-  void SetWriteToColorBuffer( bool writeToColorBuffer );
-
-  /**
-   * Turns on batching feature for the renderer
-   * @param[in] batchingEnabled if true, enables the batching mode for the renderer
-   */
-  void SetBatchingEnabled( bool batchingEnabled );
-
-  /**
-   * Tests whether batching feature is enabled for this renderer
-   * @return batching state
-   */
-  bool IsBatchingEnabled() const
-  {
-    return mBatchingEnabled;
-  }
-
-  /**
    * 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.
@@ -306,7 +277,11 @@ public:
    */
   void TextureSetChanged();
 
-public: // Implementation of ObjectOwnerContainer template methods
+  /**
+   * Called by the TextureSet to notify to the renderer that it is about to be deleted
+   */
+  void TextureSetDeleted();
+
   /**
    * Connect the object to the scene graph
    *
@@ -333,9 +308,6 @@ public: // Implementation of ConnectionChangePropagator
    */
   void RemoveConnectionObserver(ConnectionChangePropagator::Observer& observer){};
 
-public:
-
-
 public: // UniformMap::Observer
   /**
    * @copydoc UniformMap::Observer::UniformMappingsChanged
@@ -390,6 +362,12 @@ private:
    */
   RenderDataProvider* NewRenderDataProvider();
 
+  /**
+   * Helper function to retrieve the blend color.
+   * @return The blend color.
+   */
+  const Vector4& GetBlendColor() const;
+
 private:
 
   CollectedUniformMap          mCollectedUniformMap[2];           ///< Uniform maps collected by the renderer
@@ -398,9 +376,9 @@ private:
   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)
-  Vector4*                     mBlendColor;                       ///< The blend color for blending operation
+  OwnerPointer< Vector4 >      mBlendColor;                       ///< The blend color for blending operation
 
-  Render::Renderer::StencilParameters mStencilParameters;         ///< Struct containing all stencil related options
+  Dali::Internal::Render::Renderer::StencilParameters mStencilParameters;         ///< Struct containing all stencil related options
 
   size_t                       mIndexedDrawFirstElement;          ///< first element index to be drawn using indexed draw
   size_t                       mIndexedDrawElementsCount;         ///< number of elements to be drawn using indexed draw
@@ -413,7 +391,6 @@ private:
   BlendMode::Type              mBlendMode:2;                      ///< Local copy of the mode of blending
   DepthWriteMode::Type         mDepthWriteMode:2;                 ///< Local copy of the depth write mode
   DepthTestMode::Type          mDepthTestMode:2;                  ///< Local copy of the depth test mode
-  bool                         mWriteToColorBuffer:1;             ///< Local copy of the write to color buffer flag
 
   bool                         mUniformMapChanged[2];             ///< Records if the uniform map has been altered this frame
   bool                         mResourcesReady;                   ///< Set during the Update algorithm; true if the renderer has resources ready for the current frame.
@@ -422,7 +399,6 @@ private:
 
 public:
 
-  bool                         mBatchingEnabled : 1;              ///< Flag indicating whether the render supports batching
   int                          mDepthIndex;                       ///< Used only in PrepareRenderInstructions
 };
 
@@ -572,14 +548,14 @@ inline void SetDepthFunctionMessage( EventThreadServices& eventThreadServices, c
   new (slot) LocalType( &renderer, &Renderer::SetDepthFunction, depthFunction );
 }
 
-inline void SetStencilModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilMode::Type mode )
+inline void SetRenderModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode )
 {
-  typedef MessageValue1< Renderer, StencilMode::Type > LocalType;
+  typedef MessageValue1< Renderer, RenderMode::Type > LocalType;
 
   // Reserve some memory inside the message queue
   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
-  new (slot) LocalType( &renderer, &Renderer::SetStencilMode, mode );
+  new (slot) LocalType( &renderer, &Renderer::SetRenderMode, mode );
 }
 
 inline void SetStencilFunctionMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction )
@@ -652,26 +628,6 @@ inline void SetStencilOperationOnZPassMessage( EventThreadServices& eventThreadS
   new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation );
 }
 
-inline void SetWriteToColorBufferMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, bool writeToColorBuffer )
-{
-  typedef MessageValue1< Renderer, bool > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetWriteToColorBuffer, writeToColorBuffer );
-}
-
-inline void SetBatchingEnabledMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, bool batchable )
-{
-  typedef MessageValue1< Renderer, bool > LocalType;
-
-  // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
-  new (slot) LocalType( &renderer, &Renderer::SetBatchingEnabled, batchable );
-}
-
 } // namespace SceneGraph
 } // namespace Internal
 } // namespace Dali