2 * Copyright (c) 2021 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.
17 #include "test-graphics-reflection.h"
18 #include <dali/public-api/object/property-map.h>
22 TestGraphicsReflection::TestGraphicsReflection(TestGlAbstraction& gl, Property::Array& vfs)
25 for(Property::Array::SizeType i = 0; i < vfs.Count(); ++i)
27 Property::Map* vertexFormat = vfs[i].GetMap();
30 for(Property::Map::SizeType j = 0; j < vertexFormat->Count(); ++j)
32 auto key = vertexFormat->GetKeyAt(j);
33 if(key.type == Property::Key::STRING)
35 mAttributes.push_back(key.stringKey);
42 uint32_t TestGraphicsReflection::GetVertexAttributeLocation(const std::string& name) const
44 // Automatically assign locations to named attributes when requested
45 auto iter = std::find(mAttributes.begin(), mAttributes.end(), name);
46 if(iter != mAttributes.end())
48 return iter - mAttributes.begin();
52 uint32_t location = mAttributes.size();
53 mAttributes.push_back(name);
59 Dali::Graphics::VertexInputAttributeFormat TestGraphicsReflection::GetVertexAttributeFormat(uint32_t location) const
61 return Dali::Graphics::VertexInputAttributeFormat{};
64 std::string TestGraphicsReflection::GetVertexAttributeName(uint32_t location) const
69 std::vector<uint32_t> TestGraphicsReflection::GetVertexAttributeLocations() const
71 std::vector<uint32_t> locs;
72 for(uint32_t i = 0; i < mAttributes.size(); ++i)
79 uint32_t TestGraphicsReflection::GetUniformBlockCount() const
84 uint32_t TestGraphicsReflection::GetUniformBlockBinding(uint32_t index) const
89 uint32_t TestGraphicsReflection::GetUniformBlockSize(uint32_t index) const
94 bool TestGraphicsReflection::GetUniformBlock(uint32_t index, Dali::Graphics::UniformBlockInfo& out) const
99 std::vector<uint32_t> TestGraphicsReflection::GetUniformBlockLocations() const
101 return std::vector<uint32_t>{};
104 std::string TestGraphicsReflection::GetUniformBlockName(uint32_t blockIndex) const
106 return std::string{};
109 uint32_t TestGraphicsReflection::GetUniformBlockMemberCount(uint32_t blockIndex) const
114 std::string TestGraphicsReflection::GetUniformBlockMemberName(uint32_t blockIndex, uint32_t memberLocation) const
116 return std::string{};
119 uint32_t TestGraphicsReflection::GetUniformBlockMemberOffset(uint32_t blockIndex, uint32_t memberLocation) const
124 bool TestGraphicsReflection::GetNamedUniform(const std::string& name, Dali::Graphics::UniformInfo& out) const
129 std::vector<Dali::Graphics::UniformInfo> TestGraphicsReflection::GetSamplers() const
131 return std::vector<Dali::Graphics::UniformInfo>{};
134 Graphics::ShaderLanguage TestGraphicsReflection::GetLanguage() const
136 return Graphics::ShaderLanguage::GLSL_3_1;