2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/internal/update/common/collected-uniform-map.h>
21 #include <dali/devel-api/common/hash.h>
22 #include <dali/internal/render/data-providers/uniform-map-data-provider.h>
33 void CollectedUniformMap::AddMappings(const UniformMap& uniformMap)
35 // Iterate thru uniformMap.
36 // Any maps that aren't in localMap should be added in a single step
38 // keep a static vector to avoid temporary heap allocation.
39 // As this function gets called only from update thread we don't have to
40 // make it thread safe (so no need to keep a thread_local variable).
41 static Dali::Vector<UniformPropertyMapping> newUniformMappings;
43 newUniformMappings.Clear();
45 for(UniformMap::SizeType i = 0, iCount = uniformMap.Count(); i < iCount; ++i)
49 for(UniformMap::SizeType j = 0, jCount = mUniformMap.Count(); j < jCount; ++j)
51 if(mUniformMap[j].uniformName == uniformMap[i].uniformName)
59 newUniformMappings.PushBack(uniformMap[i]);
63 if(newUniformMappings.Count() > 0)
65 mUniformMap.Reserve(mUniformMap.Count() + newUniformMappings.Count());
67 for(UniformMap::SizeType i = 0, iCount = newUniformMappings.Count(); i < iCount; ++i)
69 mUniformMap.PushBack(newUniformMappings[i]);
74 } // namespace SceneGraph
75 } // namespace Internal