mProgramVAOCurrentState = iter->second;
gl.BindVertexArray(iter->second);
}
+
+ // We should re-check enable attribute usage because geometry might be changed.
+ // @todo : We can remove this loop if we enable vertex attrib by shader's information.
+ for(const auto& attr : vertexInputState.attributes)
+ {
+ gl.EnableVertexAttribArray(attr.location);
+ }
return;
}
gl.GenVertexArrays(1, &vao);
gl.BindVertexArray(vao);
mProgramVAOMap[program] = vao;
+
+ // @todo : Enable vertex attrib only by shader's information, not with Geometry.
+ // Currently, vertexInputState.attributes depend on Geometry's VertexBuffer.
for(const auto& attr : vertexInputState.attributes)
{
gl.EnableVertexAttribArray(attr.location);
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mVertexInputAttributes.clear();
mVertexInputAttributes.resize(nAttribs);
+ int maximumLocation = nAttribs - 1;
+
name = new GLchar[maxLength];
for(int i = 0; i < nAttribs; i++)
{
if(location >= 0)
{
+ if(maximumLocation < location)
+ {
+ maximumLocation = location;
+ // Increate continer size s.t. we can use maximumLocation as index.
+ mVertexInputAttributes.resize(maximumLocation + 1u);
+ }
+
AttributeInfo attributeInfo;
- attributeInfo.location = location;
- attributeInfo.name = name;
- attributeInfo.format = GetVertexAttributeTypeFormat(type);
- mVertexInputAttributes.insert(mVertexInputAttributes.begin() + location, attributeInfo);
+ attributeInfo.location = location;
+ attributeInfo.name = name;
+ attributeInfo.format = GetVertexAttributeTypeFormat(type);
+ mVertexInputAttributes[location] = std::move(attributeInfo);
}
}
+
delete[] name;
}
#define DALI_GRAPHICS_GLES_REFLECTION_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct AttributeInfo
{
- uint32_t location{};
+ uint32_t location{ERROR_ATTRIBUTE_NOT_FOUND};
std::string name{};
Dali::Graphics::VertexInputAttributeFormat format{};
};