Added local pipeline cache on the dali-core side
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-renderer.h
index 205397b..b57490f 100644 (file)
@@ -54,7 +54,9 @@ class RenderInstruction; //for reflection effect
 namespace Render
 {
 struct ShaderCache;
+class PipelineCache;
 class UniformBufferManager;
+class PipelineCache;
 
 /**
  * Renderers are used to render meshes
@@ -96,7 +98,7 @@ public:
    * @param[in] dataProviders The data providers for the renderer
    * @param[in] geometry The geometry for the renderer
    * @param[in] blendingBitmask A bitmask of blending options.
-   * @param[in] blendColor The blend color to pass to GL
+   * @param[in] blendColor The blend color
    * @param[in] faceCullingMode The face-culling mode.
    * @param[in] preMultipliedAlphaEnabled whether alpha is pre-multiplied.
    * @param[in] depthWriteMode Depth buffer write mode
@@ -120,7 +122,7 @@ public:
    * @param[in] dataProviders The data providers for the renderer
    * @param[in] geometry The geometry for the renderer
    * @param[in] blendingBitmask A bitmask of blending options.
-   * @param[in] blendColor The blend color to pass to GL
+   * @param[in] blendColor The blend color
    * @param[in] faceCullingMode The face-culling mode.
    * @param[in] preMultipliedAlphaEnabled whether alpha is pre-multiplied.
    * @param[in] depthWriteMode Depth buffer write mode
@@ -163,11 +165,13 @@ public:
    * @param[in] programCache Cache of program objects
    * @param[in] shaderCache Cache of shaders
    * @param[in] uniformBufferManager Uniform buffer manager
+   * @param[in] pipelineCache Cache of pipelines
    */
   void Initialize(Graphics::Controller&         graphicsController,
                   ProgramCache&                 programCache,
                   Render::ShaderCache&          shaderCache,
-                  Render::UniformBufferManager& uniformBufferManager);
+                  Render::UniformBufferManager& uniformBufferManager,
+                  Render::PipelineCache&        pipelineCache);
 
   /**
    * Destructor
@@ -188,7 +192,7 @@ public:
 
   /**
    * Set the blend color for blending options
-   * @param[in] blendColor The blend color to pass to GL
+   * @param[in] blendColor The blend color
    */
   void SetBlendColor(const Vector4& color);
 
@@ -400,22 +404,24 @@ public:
 
   template<class T>
   bool WriteDefaultUniform(const Graphics::UniformInfo*                       uniformInfo,
-                           Render::UniformBufferView&                             ubo,
-                           const std::vector<Graphics::UniformBufferBinding>& bindings,
+                           Render::UniformBufferView&                         ubo,
                            const T&                                           data);
 
   template<class T>
   void WriteUniform(Render::UniformBufferView&                             ubo,
-                    const std::vector<Graphics::UniformBufferBinding>& bindings,
                     const Graphics::UniformInfo&                       uniformInfo,
                     const T&                                           data);
 
   void WriteUniform(Render::UniformBufferView&                             ubo,
-                    const std::vector<Graphics::UniformBufferBinding>& bindings,
                     const Graphics::UniformInfo&                       uniformInfo,
                     const void*                                        data,
                     uint32_t                                           size);
 
+  [[nodiscard]] FaceCullingMode::Type GetFaceCullMode() const
+  {
+    return mFaceCullingMode;
+  }
+
 private:
   struct UniformIndexMap;
 
@@ -490,7 +496,7 @@ private:
    */
   void FillUniformBuffer(Program&                                      program,
                          const SceneGraph::RenderInstruction&          instruction,
-                         Render::UniformBufferView&                        ubo,
+                         Render::UniformBufferView&                    ubo,
                          std::vector<Graphics::UniformBufferBinding>*& outBindings,
                          uint32_t&                                     offset,
                          BufferIndex                                   updateBufferIndex);
@@ -507,6 +513,8 @@ private:
   Render::UniformBufferManager*               mUniformBufferManager{};
   std::vector<Graphics::UniformBufferBinding> mUniformBufferBindings{};
 
+  Render::PipelineCache* mPipelineCache{nullptr};
+
   using Hash = unsigned long;
   struct UniformIndexMap
   {
@@ -520,7 +528,6 @@ private:
   using UniformIndexMappings = Dali::Vector<UniformIndexMap>;
 
   UniformIndexMappings mUniformIndexMap;
-  Vector<int32_t>      mAttributeLocations;
   uint64_t             mUniformsHash;
 
   struct HashedPipeline
@@ -532,7 +539,6 @@ private:
       return (reinterpret_cast<uint64_t>(node) << 32) | ((reinterpret_cast<uint64_t>(instruction) & 0xFFFFFFF) << 1) | blend;
     }
   };
-  std::vector<HashedPipeline> mGraphicsPipelines{};
 
   StencilParameters mStencilParameters; ///< Struct containing all stencil related options
   BlendingOptions   mBlendingOptions;   ///< Blending options including blend color, blend func and blend equation
@@ -544,7 +550,6 @@ private:
   FaceCullingMode::Type mFaceCullingMode : 3;           ///< The mode of face culling
   DepthWriteMode::Type  mDepthWriteMode : 3;            ///< The depth write mode
   DepthTestMode::Type   mDepthTestMode : 3;             ///< The depth test mode
-  bool                  mUpdateAttributeLocations : 1;  ///< Indicates attribute locations have changed
   bool                  mPremultipliedAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
   bool                  mShaderChanged : 1;             ///< Flag indicating the shader changed and uniform maps have to be updated
   bool                  mUpdated : 1;