1 #ifndef DALI_INTERNAL_GL_EXTENSION_SUPPORT_H
2 #define DALI_INTERNAL_GL_EXTENSION_SUPPORT_H
5 * Copyright (c) 2022 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/public-api/common/vector-wrapper.h>
32 * Common extensions support checker type.
34 using ExtensionCheckerType = uint32_t;
36 struct ExtensionSupportedCache
38 bool isSupported{false};
42 struct ExtensionSupportedCacheListInterface
44 ExtensionSupportedCacheListInterface(const uint32_t maxCount)
45 : mCachedItemCount(0u),
51 inline bool NeedFullCheck() const
53 return mCachedItemCount < mMaxCount;
56 inline void SetSupported(ExtensionCheckerType type, bool isSupported = true)
58 auto& cache = mData[static_cast<uint32_t>(type)];
62 cache.isSupported = isSupported;
67 inline bool GetSupported(ExtensionCheckerType type) const
69 return mData[static_cast<uint32_t>(type)].isSupported;
72 inline bool GetCached(ExtensionCheckerType type) const
74 return mData[static_cast<uint32_t>(type)].cached;
77 void SetAllUncachedAsNotSupported()
81 for(auto&& iter : mData)
85 iter.isSupported = false;
91 mCachedItemCount = mMaxCount;
95 uint32_t mCachedItemCount;
96 const uint32_t mMaxCount;
98 std::vector<ExtensionSupportedCache> mData;
102 * Gl extensions support checker system.
104 namespace GlExtensionCache
106 enum GlExtensionCheckerType
108 BLEND_EQUATION_ADVANCED = 0,
109 MULTISAMPLED_RENDER_TO_TEXTURE,
110 ///< Append additional extension checker type here.
111 EXTENSION_CHECKER_TYPE_MAX,
114 struct GlExtensionSupportedCacheList : public ExtensionSupportedCacheListInterface
116 GlExtensionSupportedCacheList()
117 : ExtensionSupportedCacheListInterface(static_cast<size_t>(GlExtensionCheckerType::EXTENSION_CHECKER_TYPE_MAX))
122 * Ensure that we check all gl extension features for this system.
124 void EnsureGlExtensionSupportedCheck();
126 } // namespace GlExtensionCache
128 } // namespace Adaptor
130 } // namespace Internal
134 #endif /* DALI_INTERNAL_GL_EXTENSION_SUPPORT_H */