Geometry Batching
[platform/core/uifw/dali-core.git] / dali / internal / update / rendering / scene-graph-renderer.h
index 4249b0f..1a86cb9 100644 (file)
@@ -87,6 +87,14 @@ public:
    */
   void SetTextures( TextureSet* textureSet );
 
+  /**
+   * Returns current texture set object
+   * @return Pointer to the texture set
+   */
+  const TextureSet* GetTextures() const
+  {
+    return mTextureSet;
+  }
 
   /**
    * Set the shader for the renderer
@@ -98,7 +106,7 @@ public:
    * Get the shader used by this renderer
    * @return the shader this renderer uses
    */
-  Shader& GetShader()
+  const Shader& GetShader() const
   {
     return *mShader;
   }
@@ -110,6 +118,15 @@ 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
    */
@@ -239,6 +256,21 @@ public:
   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.
@@ -390,6 +422,7 @@ private:
 
 public:
 
+  bool                         mBatchingEnabled : 1;              ///< Flag indicating whether the render supports batching
   int                          mDepthIndex;                       ///< Used only in PrepareRenderInstructions
 };
 
@@ -629,6 +662,16 @@ inline void SetWriteToColorBufferMessage( EventThreadServices& eventThreadServic
   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