[dali_2.3.44] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / configuration-manager.h
1 #ifndef DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H
2 #define DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H
3
4 /*
5  * Copyright (c) 2024 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <memory>
23 #include <string>
24
25 namespace Dali
26 {
27 class FileStream;
28
29 namespace Graphics
30 {
31 class GraphicsInterface;
32 }
33
34 namespace Internal::Adaptor
35 {
36 class ThreadController;
37
38 /**
39  * This class retrieves and caches the system configuration.
40  * Some of the methods in this class can block system until GL has been initialized,
41  * only at the first time the DALi application is launched in the system.
42  */
43 class ConfigurationManager
44 {
45 public:
46   /**
47    * @brief Constructor
48    */
49   ConfigurationManager(std::string systemCachePath, Dali::Graphics::GraphicsInterface* graphics, ThreadController* threadController);
50
51   /**
52    * @brief Virtual Destructor for interface cleanup
53    */
54   virtual ~ConfigurationManager();
55
56   /**
57    * @brief Retrieve all keys from the config file if the file exists.
58    */
59   void RetrieveKeysFromConfigFile(const std::string& configFilePath);
60
61   /**
62    * @brief Get the maximum texture size.
63    * @return The maximum texture size
64    */
65   uint32_t GetMaxTextureSize();
66
67   /**
68    * @brief Get the maximum number of combined texture units (across all shaders in program)
69    * @return the number of combined texture units
70    */
71   uint32_t GetMaxCombinedTextureUnits();
72
73   /**
74    * @brief Get the shader language version that the system supports
75    * @return the shader language version.
76    */
77   uint32_t GetShadingLanguageVersion();
78
79   /**
80    * @brief Check whether multiple window is supported
81    * @return Whether multiple window is supported
82    */
83   bool IsMultipleWindowSupported();
84
85   /**
86    * @brief Check whether blend equation advanced (extension) is supported
87    * @return Whether blend equation advanced (extension) is supported
88    */
89   bool IsAdvancedBlendEquationSupported();
90   /**
91    * @brief Check whether multisampled render to texture (extension) is supported
92    * @return Whether multisampled render to texture (extension) is supported
93    */
94   bool IsMultisampledRenderToTextureSupported();
95
96   // Deleted copy constructor.
97   ConfigurationManager(const ConfigurationManager&) = delete;
98
99   // Deleted move constructor.
100   ConfigurationManager(const ConfigurationManager&&) = delete;
101
102   // Deleted assignment operator.
103   ConfigurationManager& operator=(const ConfigurationManager&) = delete;
104
105   // Deleted move assignment operator.
106   ConfigurationManager& operator=(const ConfigurationManager&&) = delete;
107
108 private:                                                                // Data
109   std::string        mSystemCacheFilePath;                              ///< The path of system cache file
110   Dali::Graphics::GraphicsInterface* mGraphics;                         ///< Graphics interface
111   ThreadController*  mThreadController;                                 ///< The thread controller
112   unsigned int       mMaxTextureSize;                                   ///< The largest texture that the GL can handle
113   unsigned int       mMaxCombinedTextureUnits;                          ///< The maximum number of combined texture units
114   unsigned int       mShaderLanguageVersion;                            ///< The shader language version that the system supports.
115   bool               mIsMultipleWindowSupported : 1;                    ///< Whether multiple window is supported by the GLES
116   bool               mIsAdvancedBlendEquationSupported : 1;             ///< Whether blend equation advanced (extension) is supported by the GLES
117   bool               mIsMultisampledRenderToTextureSupported : 1;       ///< Whether multisampled render to texture (extension) is supported by the GLES
118   bool               mMaxTextureSizeCached : 1;                         ///< Whether we have checked the maximum texture size
119   bool               mIsMultipleWindowSupportedCached : 1;              ///< Whether we have checked the support of multiple window
120   bool               mIsAdvancedBlendEquationSupportedCached : 1;       ///< Whether we have checked the support of blend equation advanced (extension)
121   bool               mIsMultisampledRenderToTextureSupportedCached : 1; ///< Whether we have checked the support of multisampled render to texture (extension)
122   bool               mShaderLanguageVersionCached : 1;                  ///< Whether we have checked the shader language version
123   bool               mMaxCombinedTextureUnitsCached : 1;                ///< Whether we have checked the maximum number of combined texture units
124 };
125
126 } // namespace Internal::Adaptor
127 } // namespace Dali
128
129 #endif // DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H