Merge "Added memory pool logging" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-instruction.h
index dc613fa..f8d24aa 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_H
+#define DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_H
 
 /*
- * Copyright (c) 2016 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/public-api/math/matrix.h>
-#include <dali/public-api/math/viewport.h>
-#include <dali/internal/update/render-tasks/scene-graph-camera.h>
 #include <dali/internal/render/common/render-list.h>
 #include <dali/internal/render/renderers/render-frame-buffer.h>
+#include <dali/internal/update/render-tasks/scene-graph-camera.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/viewport.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace Render
 {
 class RenderTracker;
@@ -38,7 +36,6 @@ class RenderTracker;
 
 namespace SceneGraph
 {
-
 /**
  * A set of rendering instructions consisting of:
  * - The list(s) of renderers sorted in the correct rendering order.
@@ -50,7 +47,6 @@ namespace SceneGraph
 class RenderInstruction
 {
 public:
-
   /**
    * Default constructor so this can be stored in STL containers
    */
@@ -61,12 +57,16 @@ public:
    */
   ~RenderInstruction();
 
+  RenderInstruction(const RenderInstruction&) = delete;
+
+  RenderInstruction& operator=(const RenderInstruction& rhs) = delete;
+
   /**
    * Get the next free Renderlist
    * @param capacityRequired in this list
    * @return the renderlist
    */
-  RenderList& GetNextFreeRenderList( size_t capacityRequired );
+  RenderList& GetNextFreeRenderList(size_t capacityRequired);
 
   /**
    * Inform the RenderInstruction that processing for this frame is complete
@@ -77,7 +77,7 @@ public:
   /**
    * @return the count of active Renderlists
    */
-  RenderListContainer::SizeType RenderListCount() const;
+  [[nodiscard]] RenderListContainer::SizeType RenderListCount() const;
 
   /**
    * Return the renderlist at given index
@@ -85,7 +85,7 @@ public:
    * @param index of list to return
    * @return pointer to the renderlist, or null if the index is out of bounds.
    */
-  const RenderList* GetRenderList( RenderListContainer::SizeType index ) const;
+  [[nodiscard]] const RenderList* GetRenderList(RenderListContainer::SizeType index) const;
 
   /**
    * Reset render-instruction
@@ -97,20 +97,20 @@ public:
    * @param[in] viewport A pointer to a viewport, of NULL.
    * @param[in] clearColor A pointer to a color to clear with, or NULL if no clear is required.
    */
-  void Reset( Camera* camera,
-              Render::FrameBuffer* frameBuffer,
-              const Viewport* viewport,
-              const Vector4* clearColor );
+  void Reset(Camera*              camera,
+             Render::FrameBuffer* frameBuffer,
+             const Viewport*      viewport,
+             const Vector4*       clearColor);
 
   /**
    * Get the view matrix for rendering
    * @param index of the rendering side
    * @return the view matrix
    */
-  const Matrix* GetViewMatrix( BufferIndex index ) const
+  [[nodiscard]] const Matrix* GetViewMatrix(BufferIndex index) const
   {
     // inlined as this is called once per frame per render instruction
-    return &mCamera->GetViewMatrix( index );
+    return &mCamera->GetViewMatrix(index);
   }
 
   /**
@@ -118,36 +118,37 @@ public:
    * @param index of the rendering side
    * @return the projection matrix
    */
-  const Matrix* GetProjectionMatrix( BufferIndex index ) const
+  [[nodiscard]] const Matrix* GetProjectionMatrix(BufferIndex index) const
   {
     // inlined as this is called once per frame per render instruction
-    return &mCamera->GetProjectionMatrix( index );
+    return &mCamera->GetFinalProjectionMatrix(index);
+  }
+  // for reflection effect
+  [[nodiscard]] const Camera* GetCamera() const
+  {
+    return mCamera;
   }
 
-private:
-
-  // Undefined
-  RenderInstruction(const RenderInstruction&);
-  // Undefined
-  RenderInstruction& operator=(const RenderInstruction& rhs);
-
-public: // Data
+  /**
+   * Get the total memory usage of the render instruction
+   */
+  std::size_t GetCapacity();
 
-  Render::RenderTracker* mRenderTracker;        ///< Pointer to an optional tracker object (not owned)
+public:                                  // Data
+  Render::RenderTracker* mRenderTracker; ///< Pointer to an optional tracker object (not owned)
 
-  Viewport mViewport;                   ///< Optional viewport
-  Vector4  mClearColor;                 ///< Optional color to clear with
-  bool     mIsViewportSet:1;            ///< Flag to determine whether the viewport is set
-  bool     mIsClearColorSet:1;          ///< Flag to determine whether the clearColor is set
+  Viewport mViewport;              ///< Optional viewport
+  Vector4  mClearColor;            ///< Optional color to clear with
+  bool     mIsViewportSet : 1;     ///< Flag to determine whether the viewport is set
+  bool     mIsClearColorSet : 1;   ///< Flag to determine whether the clearColor is set
+  bool     mIgnoreRenderToFbo : 1; ///< Whether to ignore the render to FBO option (used to measure the performance above 60 fps)
 
   Render::FrameBuffer* mFrameBuffer;
 
-private: // Data
-
-  Camera* mCamera;  ///< camera that is used
-  RenderListContainer mRenderLists;     ///< container of all render lists
-  RenderListContainer::SizeType mNextFreeRenderList;     ///< index for the next free render list
-
+private:                                             // Data
+  Camera*                       mCamera;             ///< camera that is used
+  RenderListContainer           mRenderLists;        ///< container of all render lists
+  RenderListContainer::SizeType mNextFreeRenderList; ///< index for the next free render list
 };
 
 } // namespace SceneGraph
@@ -156,4 +157,4 @@ private: // Data
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_H