From 951f5997065d39597e2aad1e4586a11053d6fe1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Sun, 4 Jun 2017 02:47:20 +0200 Subject: [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. --- src/mbgl/gl/attribute.cpp | 1 + 1 file changed, 1 insertion(+) 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::bind(Context& context, } context.vertexBuffer = vertexBuffer; MBGL_CHECK_ERROR(glEnableVertexAttribArray(location)); + oldBinding = *this; MBGL_CHECK_ERROR(glVertexAttribPointer( location, static_cast(attributeSize), -- cgit v1.2.1