Geometry Batching
[platform/core/uifw/dali-core.git] / dali / internal / update / manager / prepare-render-instructions.h
index d8e794f..bd16804 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_SCENE_GRAPH_PREPARE_RENDER_INSTRUCTIONS_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -21,6 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/internal/common/buffer-index.h>
 #include <dali/internal/update/manager/sorted-layers.h>
+#include <dali/integration-api/resource-declarations.h>
 
 namespace Dali
 {
@@ -28,13 +29,17 @@ namespace Dali
 namespace Internal
 {
 
+namespace Render
+{
+class Geometry;
+}
+
 namespace SceneGraph
 {
 class RenderTracker;
-class RenderItem;
+struct RenderItem;
 class Shader;
-class Material;
-class Geometry;
+class GeometryBatcher;
 
 /**
  * Structure to store information for sorting the renderers.
@@ -45,17 +50,17 @@ struct RendererWithSortAttributes
   RendererWithSortAttributes()
   : renderItem( NULL ),
     shader(NULL),
-    material(NULL),
+    textureResourceId( Integration::InvalidResourceId ),
     geometry(NULL),
     zValue(0.0f)
   {
   }
 
-  RenderItem* renderItem;       ///< The render item that is being sorted (includes depth index)
-  Shader*     shader;           ///< The shader instance
-  Material*   material;         ///< The material instance
-  Geometry*   geometry;         ///< The geometry instance
-  float       zValue;           // The zValue of the given renderer (either distance from camera, or a custom calculated value)
+  RenderItem*                   renderItem;       ///< The render item that is being sorted (includes depth index)
+  const Shader*                 shader;           ///< The shader instance
+  Integration::ResourceId       textureResourceId;///< The first texture resource ID of the texture set instance, is InvalidResourceId if the texture set doesn't have any textures
+  const Render::Geometry*       geometry;         ///< The geometry instance
+  float                         zValue;           ///< The zValue of the given renderer (either distance from camera, or a custom calculated value)
 };
 
 typedef std::vector< RendererWithSortAttributes > RendererSortingHelper;
@@ -64,12 +69,11 @@ class RenderTask;
 class RenderInstructionContainer;
 
 /**
- * Sorts and prepares the list of opaque/transparent renderable
- * attachments for each layer.  Whilst iterating through each layer,
- * update the attachments ModelView matrices
+ * Sorts and prepares the list of opaque/transparent renderers for each layer.
+ * Whilst iterating through each layer, update the renderitems ModelView matrices
  *
  * The opaque and transparent render lists are sorted first by depth
- * index, then by Z (for transparent only), then by shader, material
+ * index, then by Z (for transparent only), then by shader, texture
  * and geometry. The render algorithm should then work through both
  * lists simultaneously, working through opaque then transparent
  * items at each depth index, resetting the flags appropriately.
@@ -77,15 +81,17 @@ class RenderInstructionContainer;
  * @param[in] updateBufferIndex The current update buffer index.
  * @param[in] sortedLayers The layers containing lists of opaque/transparent renderables.
  * @param[in] renderTask The rendering task information.
- * @param[in] renderTracker A tracker object if we need to know when this render instruction has actually rendered, or NULL if tracking is not required
+ * @param[in] sortingHelper to avoid allocating containers for sorting every frame
+ * @param[in] cull Whether frustum culling is enabled or not
  * @param[out] instructions The rendering instructions for the next frame.
  */
 void PrepareRenderInstruction( BufferIndex updateBufferIndex,
                                SortedLayerPointers& sortedLayers,
                                RenderTask& renderTask,
                                RendererSortingHelper& sortingHelper,
-                               RenderTracker* renderTracker,
-                               RenderInstructionContainer& instructions );
+                               bool cull,
+                               RenderInstructionContainer& instructions,
+                               GeometryBatcher& geometryBatcher );
 
 } // namespace SceneGraph