summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-06-04 02:47:20 +0200
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-06-14 11:13:43 -0700
commit951f5997065d39597e2aad1e4586a11053d6fe1f (patch)
treef01a155d7be694668ca91090a2c8b21285d03353 /src
parent441b80d574783e959bf18c01bdb8cfee740424c5 (diff)
downloadqtlocation-mapboxgl-951f5997065d39597e2aad1e4586a11053d6fe1f.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.
Diffstat (limited to 'src')
-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),