summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/vertex_array.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-04-11 13:27:21 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-04-13 18:27:14 +0200
commitec12bab1acce951976a152e2fd9f2110a327285e (patch)
tree20edb5dc546af978a377d38377c808142229154c /src/mbgl/gl/vertex_array.cpp
parent8543ae6e11c21b477c42bc10e73aedba190df592 (diff)
downloadqtlocation-mapboxgl-upstream/attribute-binding-crash.tar.gz
[core] warn about using too many data driven properties instead of crashingupstream/attribute-binding-crash
Instead, we're printing a warning message and won't bind the attributes beyond the limit. This will cause rendering errors, but it's still better than crashing.
Diffstat (limited to 'src/mbgl/gl/vertex_array.cpp')
-rw-r--r--src/mbgl/gl/vertex_array.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mbgl/gl/vertex_array.cpp b/src/mbgl/gl/vertex_array.cpp
index 68a500ac45..d552a8292e 100644
--- a/src/mbgl/gl/vertex_array.cpp
+++ b/src/mbgl/gl/vertex_array.cpp
@@ -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];
}
}