Merge "Sync UTC harness" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-instruction-container.h
index 1bcff8b..f2292c7 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H
+#define DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
 // INTERNAL INCLUDES
 #include <dali/devel-api/common/owner-container.h>
 #include <dali/internal/common/buffer-index.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <cstddef>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace SceneGraph
 {
 class RenderInstruction;
 
 /**
- * Class to encapsulate double buffered render instruction data
+ * Class to hold ordered list of current frame's render instructions.
+ * Does not own the instructions.
  */
 class RenderInstructionContainer
 {
 public:
-
   /**
    * Constructor
    */
@@ -54,34 +54,35 @@ public:
    * @param bufferIndex to reset
    * @param capacityRequired in the container
    */
-  void ResetAndReserve( BufferIndex bufferIndex, size_t capacityRequired );
+  void ResetAndReserve(BufferIndex bufferIndex, uint32_t capacityRequired);
 
   /**
    * Return the count of instructions in the container
    * @param bufferIndex to use
    * @return the count of elements
    */
-  size_t Count( BufferIndex bufferIndex );
+  uint32_t Count(BufferIndex bufferIndex);
 
   /**
-   * Get a reference to the next instruction
+   * Get a reference to the instruction at index
    * @param bufferIndex to use
+   * @param index to use
    */
-  RenderInstruction& GetNextInstruction( BufferIndex bufferIndex );
+  RenderInstruction& At(BufferIndex bufferIndex, uint32_t index);
 
   /**
-   * Get a reference to the instruction at index
+   * Add an instruction to the end of the container
    * @param bufferIndex to use
-   * @param index to use
    */
-  RenderInstruction& At( BufferIndex bufferIndex, size_t index );
-
-private:
+  void PushBack(BufferIndex index, RenderInstruction* renderInstruction);
 
-  unsigned int mIndex[ 2 ]; ///< count of the elements that have been added
-  typedef OwnerContainer< RenderInstruction* > InstructionContainer;
-  InstructionContainer mInstructions[ 2 ]; /// Double buffered instruction lists
+  /**
+   * Get the total memory used by all the render instructions
+   */
+  std::size_t GetCapacity() const;
 
+private:
+  std::vector<RenderInstruction*> mInstructions;
 };
 
 } // namespace SceneGraph
@@ -90,4 +91,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H