1 #ifndef DALI_GRAPHICS_GLES_PIPELINE_CACHE_H
2 #define DALI_GRAPHICS_GLES_PIPELINE_CACHE_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/graphics-api/graphics-pipeline-create-info.h>
23 #include <dali/graphics-api/graphics-pipeline.h>
24 #include <dali/graphics-api/graphics-program-create-info.h>
25 #include <dali/graphics-api/graphics-program.h>
28 #include "gles-graphics-resource.h"
30 namespace Dali::Graphics
32 class EglGraphicsController;
40 * @brief PipelineCache manages pipeline and program
41 * objects so there are no duplicates created.
49 explicit PipelineCache(EglGraphicsController& controller);
57 * @brief Retrieves pipeline matching the spec
59 * Function returns either existing pipeline if one is found
60 * in the cache or creates new one.
62 * @param[in] pipelineCreateInfo Valid PipelineCreateInfo structure
63 * @param[in] oldPipeline previous pipeline object
64 * @return Pipeline object
66 Graphics::UniquePtr<Graphics::Pipeline> GetPipeline(const PipelineCreateInfo& pipelineCreateInfo, Graphics::UniquePtr<Graphics::Pipeline>&& oldPipeline);
69 * @brief Retrieves program matching the spec
71 * Function returns either existing program if one is found
72 * in the cache or creates new one.
74 * @param[in] programCreateInfo Valid ProgramCreateInfo structure
75 * @param[in] oldProgram previous program object
76 * @return Program object
78 Graphics::UniquePtr<Graphics::Program> GetProgram(const ProgramCreateInfo& pipelineCreateInfo, Graphics::UniquePtr<Graphics::Program>&& oldProgram);
81 * @brief Flushes pipeline and program cache
83 * Removes cached items when they are no longer needed. This function
84 * should be called at the very end of Controller render loop iteration.
90 * @brief Finds pipeline implementation based on the spec
91 * @param[in] info Valid create info structure
92 * @return Returns pointer to pipeline or nullptr
94 PipelineImpl* FindPipelineImpl(const PipelineCreateInfo& info);
97 * @brief Finds program implementation based on the spec
98 * @param[in] info Valid create info structure
99 * @return Returns pointer to program or nullptr
101 ProgramImpl* FindProgramImpl(const ProgramCreateInfo& info);
105 std::unique_ptr<Impl> mImpl;
108 } // namespace Dali::Graphics