Mesa (master): mesa: simplify and optimise vertex bindings tracking

Timothy Arceri tarceri at kemper.freedesktop.org
Sat Apr 8 01:20:03 UTC 2017


Module: Mesa
Branch: master
Commit: 9d69416a7ee041ca45998b2e46dac3e476fb41d2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d69416a7ee041ca45998b2e46dac3e476fb41d2

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Thu Apr  6 14:47:34 2017 +1000

mesa: simplify and optimise vertex bindings tracking

We only need to update it if something changes. Also
_mesa_bind_vertex_buffer() will update the mask when binding to a
NULL or default buffer so no need to do that update here.

Reviewed-by: Juan A. Suarez Romero <jasuarez at igalia.com>

---

 src/mesa/main/varray.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 1312695779..233dc0dc41 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -137,14 +137,12 @@ vertex_attrib_binding(struct gl_context *ctx,
 {
    struct gl_array_attributes *array = &vao->VertexAttrib[attribIndex];
 
-   if (!_mesa_is_bufferobj(vao->BufferBinding[bindingIndex].BufferObj))
-      vao->VertexAttribBufferMask &= ~VERT_BIT(attribIndex);
-   else
-      vao->VertexAttribBufferMask |= VERT_BIT(attribIndex);
-
    if (array->BufferBindingIndex != bindingIndex) {
       const GLbitfield64 array_bit = VERT_BIT(attribIndex);
 
+      if (_mesa_is_bufferobj(vao->BufferBinding[bindingIndex].BufferObj))
+         vao->VertexAttribBufferMask |= array_bit;
+
       FLUSH_VERTICES(ctx, _NEW_ARRAY);
 
       vao->BufferBinding[array->BufferBindingIndex]._BoundArrays &= ~array_bit;




More information about the mesa-commit mailing list