1 #ifndef DALI_INTERNAL_SCENE_GRAPH_COLLECTED_UNIFORM_MAP_H
2 #define DALI_INTERNAL_SCENE_GRAPH_COLLECTED_UNIFORM_MAP_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.
19 #include <dali/internal/common/buffer-index.h>
20 #include <dali/internal/update/common/uniform-map.h>
21 #include <dali/public-api/common/dali-vector.h>
30 class UniformPropertyMapping;
33 * Class to collect uniform mappings together into a new map.
34 * Distinct from UniformMap, as it doesn't need the observation/lifecycle
37 * It has a counter that increments each time it's changed, which
38 * allows a client to know if it's been modified since the last time
41 struct CollectedUniformMap
46 CollectedUniformMap() = default;
51 ~CollectedUniformMap() = default;
54 * @brief Add mappings from a UniformMap.
55 * @param[in] uniformMap to copy
57 void AddMappings(const UniformMap& uniformMap);
65 UpdateChangeCounter();
69 * Reserve space for mappings
70 * @param[in] size The number of mappings to reserve
72 inline void Reserve(std::size_t size)
74 mUniformMap.Reserve(size);
78 * @return the count of the number of mappings
80 inline std::size_t Count() const
82 return mUniformMap.Size();
86 * @brief Update the change counter if the map changes.
88 void UpdateChangeCounter()
94 * Return the currently calculated hash.
96 inline std::size_t GetChangeCounter() const
98 return mChangeCounter;
101 Dali::Vector<UniformPropertyMapping> mUniformMap; ///< The mappings
102 std::size_t mChangeCounter{0u}; ///< The change counter
105 } // namespace SceneGraph
106 } // namespace Internal
109 #endif // DALI_INTERNAL_SCENE_GRAPH_COLLECTED_UNIFORM_MAP_H