summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-06-04 02:47:20 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-06-13 19:21:20 +0200
commit9a05ebac5202b6e4b59f43707b96b4acd4c00b7b (patch)
tree985d2c69f3b7511687845f42490b905d5d9940b1
parentbb544136f37c67f1ceea9a0b0c2ac780e72a1596 (diff)
downloadqtlocation-mapboxgl-9a05ebac5202b6e4b59f43707b96b4acd4c00b7b.tar.gz
[core] store vertex attribute binding to prevent duplicate binds
We have an "oldBinding" value that we use for checking whether the vertex attribute was already bound to the current VAO, but we never set the state. Additionally, we're also checking whether the previous state was already any binding (optional is set), and don't re-enable the vertex attribute array. Additionally, we now only disable the vertex attribute array when the previous state was in fact an array attribute. We still don't deduplicate constant glVertexAttrib* calls, but that's a little trickier.
-rw-r--r--src/mbgl/gl/attribute.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mbgl/gl/attribute.cpp b/src/mbgl/gl/attribute.cpp
index eacaa37457..8c52121f6e 100644
--- a/src/mbgl/gl/attribute.cpp
+++ b/src/mbgl/gl/attribute.cpp
@@ -29,6 +29,7 @@ void VariableAttributeBinding<T, N>::bind(Context& context,
}
context.vertexBuffer = vertexBuffer;
MBGL_CHECK_ERROR(glEnableVertexAttribArray(location));
+ oldBinding = *this;
MBGL_CHECK_ERROR(glVertexAttribPointer(
location,
static_cast<GLint>(attributeSize),