1 #ifndef DALI_GRAPHICS_GLES_RESOURCE_H
2 #define DALI_GRAPHICS_GLES_RESOURCE_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.
21 namespace Dali::Graphics
23 class EglGraphicsController;
28 * @brief Base class for the Graphics resource.
30 template<class BASE, class CreateInfo>
31 class Resource : public BASE
36 * @param[in] createInfo CreateInfo structure for the resource
37 * @param[in] controller Reference to the controller
39 Resource(const CreateInfo& createInfo, Graphics::EglGraphicsController& controller)
40 : mCreateInfo(createInfo),
41 mController(controller)
48 ~Resource() override = default;
51 * @brief Retrieves create info structure
52 * @return Reference to the create info structure
54 [[nodiscard]] const CreateInfo& GetCreateInfo() const
60 * @brief Retrieves controller
61 * @return Reference to the controller object
63 [[nodiscard]] Graphics::EglGraphicsController& GetController() const
69 * @brief Destroys resource
71 * This function must be implemented by the derived class.
72 * It should perform final destruction of used GL resources.
74 virtual void DestroyResource() = 0;
77 * @brief Initializes resource
79 * This function must be implemented by the derived class.
80 * It should initialize all necessary GL resources.
82 * @return True on success
84 virtual bool InitializeResource() = 0;
87 * @brief Discards resource by adding it to the discard queue
89 virtual void DiscardResource() = 0;
92 * @brief returns pointer to base
101 CreateInfo mCreateInfo; ///< CreateInfo structure
102 Graphics::EglGraphicsController& mController; ///< Reference to the Controller object
105 } // namespace Dali::Graphics