[core] Don't crash when attribute count is exceeded

This commit is contained in:
Konstantin Käfer
2018-05-04 01:31:43 +02:00
committed by Lauren Budorick
parent f6da3ba9be
commit c3346f473a
23 changed files with 557 additions and 237 deletions

View File

@@ -9,7 +9,11 @@ void VertexArray::bind(Context& context, BufferID indexBuffer, const AttributeBi
context.bindVertexArray = state->vertexArray;
state->indexBuffer = indexBuffer;
for (AttributeLocation location = 0; location < MAX_ATTRIBUTES; ++location) {
state->bindings.reserve(bindings.size());
for (AttributeLocation location = 0; location < bindings.size(); ++location) {
if (state->bindings.size() <= location) {
state->bindings.emplace_back(context, AttributeLocation(location));
}
state->bindings[location] = bindings[location];
}
}