mProgramVAOCurrentState = iter->second;
gl.BindVertexArray(iter->second);
}
+
+ // We should re-check enable attribute usage because geometry might be changed.
+ for(const auto& attr : vertexInputState.attributes)
+ {
+ gl.EnableVertexAttribArray(attr.location);
+ }
return;
}
mVertexInputAttributes.clear();
mVertexInputAttributes.resize(nAttribs);
+
+ int maxLocationValue = nAttribs - 1;
name = new GLchar[maxLength];
for(int i = 0; i < nAttribs; i++)
if(location >= 0)
{
+ if(maxLocationValue < location)
+ {
+ maxLocationValue = location;
+ mVertexInputAttributes.resize(maxLocationValue + 1u);
+ }
+
AttributeInfo attributeInfo;
attributeInfo.location = location;
attributeInfo.name = name;
attributeInfo.format = GetVertexAttributeTypeFormat(type);
- mVertexInputAttributes.insert(mVertexInputAttributes.begin() + location, attributeInfo);
+ mVertexInputAttributes[location] = std::move(attributeInfo);
}
}
+
delete[] name;
}