Mesa (master): mesa: Update VAO internal state when setting the _DrawVAO.

Mathias Fröhlich frohlich at kemper.freedesktop.org
Thu Mar 22 04:25:07 UTC 2018


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

Author: Mathias Fröhlich <mathias.froehlich at web.de>
Date:   Fri Mar 16 06:34:35 2018 +0100

mesa: Update VAO internal state when setting the _DrawVAO.

Update the VAO internal state on Array._DrawVAO instead of
Array.VAO. Also the VAO internal state update gets triggered now
by a change of Array._DrawVAO instead of the _NEW_ARRAY state flag.
Also no driver looks at any VAO's NewArrays value from within
the Driver.UpdateState callback. So it should be safe to move
this update into the _mesa_set_draw_vao method.

Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>

---

 src/mesa/main/arrayobj.c     |  6 ++++++
 src/mesa/main/state.c        | 12 +++++++-----
 src/mesa/vbo/vbo_exec_draw.c |  3 ---
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 7cb9833719..0d2f7a918a 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -461,6 +461,12 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx,
 {
    /* Make sure we do not run into problems with shared objects */
    assert(!vao->SharedAndImmutable || vao->NewArrays == 0);
+
+   /*
+    * Stay tuned, the next series scans for duplicate bindings in this
+    * function. So that drivers can easily know the minimum unique set
+    * of bindings.
+    */
 }
 
 
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 6dd7a7ec07..e523bccd0c 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -360,9 +360,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
          update_program(ctx);
    }
 
-   if (new_state & _NEW_ARRAY)
-      _mesa_update_vao_derived_arrays(ctx, ctx->Array.VAO);
-
  out:
    new_prog_state |= update_program_constants(ctx);
 
@@ -377,7 +374,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
     */
    ctx->Driver.UpdateState(ctx);
    ctx->NewState = 0;
-   ctx->Array.VAO->NewArrays = 0x0;
 }
 
 
@@ -496,8 +492,14 @@ _mesa_set_draw_vao(struct gl_context *ctx, struct gl_vertex_array_object *vao,
    struct gl_vertex_array_object **ptr = &ctx->Array._DrawVAO;
    if (*ptr != vao) {
       _mesa_reference_vao_(ctx, ptr, vao);
+
       ctx->NewDriverState |= ctx->DriverFlags.NewArray;
-   } else if (vao->NewArrays) {
+   }
+
+   if (vao->NewArrays) {
+      _mesa_update_vao_derived_arrays(ctx, vao);
+      vao->NewArrays = 0;
+
       ctx->NewDriverState |= ctx->DriverFlags.NewArray;
    }
 
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 1ed9d5eac0..3490dbe44d 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -231,9 +231,6 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
    assert(!_mesa_is_bufferobj(exec->vtx.bufferobj) ||
           (vao_enabled & ~vao->VertexAttribBufferMask) == 0);
 
-   _mesa_update_vao_derived_arrays(ctx, vao);
-   vao->NewArrays = 0;
-
    _mesa_set_draw_vao(ctx, vao, _vbo_get_vao_filter(mode));
    /* The exec VAO is not immutable, so we need to set manually */
    ctx->NewDriverState |= ctx->DriverFlags.NewArray;




More information about the mesa-commit mailing list