Mesa (master): mesa: rework _ae_invalidate_state() so that it just sets a dirty flag

Timothy Arceri tarceri at kemper.freedesktop.org
Thu Jun 8 23:14:02 UTC 2017


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

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Wed Jun  7 14:02:03 2017 +1000

mesa: rework _ae_invalidate_state() so that it just sets a dirty flag

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/main/api_arrayelt.c | 26 +++++++++++++-------------
 src/mesa/main/api_arrayelt.h |  2 +-
 src/mesa/vbo/vbo_context.h   |  9 +++++----
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index 8eb523dd52..2dfa74f64b 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -65,12 +65,13 @@ typedef struct {
 typedef struct {
    AEarray arrays[32];
    AEattrib attribs[VERT_ATTRIB_MAX + 1];
-   GLbitfield NewState;
 
    /* List of VBOs we need to map before executing ArrayElements */
    struct gl_buffer_object *vbo[VERT_ATTRIB_MAX];
    GLuint nr_vbos;
    GLboolean mapped_vbos;  /**< Any currently mapped VBOs? */
+
+   bool dirty_state;
 } AEcontext;
 
 
@@ -97,7 +98,7 @@ TYPE_IDX(GLenum t)
 bool
 _ae_is_state_dirty(struct gl_context *ctx)
 {
-   return AE_CONTEXT(ctx)->NewState;
+   return AE_CONTEXT(ctx)->dirty_state;
 }
 
 
@@ -1518,7 +1519,7 @@ _ae_create_context(struct gl_context *ctx)
    if (!ctx->aelt_context)
       return GL_FALSE;
 
-   AE_CONTEXT(ctx)->NewState = ~0;
+   AE_CONTEXT(ctx)->dirty_state = true;
    return GL_TRUE;
 }
 
@@ -1697,7 +1698,7 @@ _ae_update_state(struct gl_context *ctx)
    at->func = NULL;  /* terminate the list */
    aa->offset = -1;  /* terminate the list */
 
-   actx->NewState = 0;
+   actx->dirty_state = false;
 }
 
 
@@ -1714,7 +1715,7 @@ _ae_map_vbos(struct gl_context *ctx)
    if (actx->mapped_vbos)
       return;
 
-   if (actx->NewState)
+   if (actx->dirty_state)
       _ae_update_state(ctx);
 
    for (i = 0; i < actx->nr_vbos; i++)
@@ -1741,7 +1742,7 @@ _ae_unmap_vbos(struct gl_context *ctx)
    if (!actx->mapped_vbos)
       return;
 
-   assert (!actx->NewState);
+   assert (!actx->dirty_state);
 
    for (i = 0; i < actx->nr_vbos; i++)
       ctx->Driver.UnmapBuffer(ctx, actx->vbo[i], MAP_INTERNAL);
@@ -1774,7 +1775,7 @@ _ae_ArrayElement(GLint elt)
       return;
    }
 
-   if (actx->NewState) {
+   if (actx->dirty_state) {
       assert(!actx->mapped_vbos);
       _ae_update_state(ctx);
    }
@@ -1809,7 +1810,7 @@ _ae_ArrayElement(GLint elt)
 
 
 void
-_ae_invalidate_state(struct gl_context *ctx, GLbitfield new_state)
+_ae_invalidate_state(struct gl_context *ctx)
 {
    AEcontext *actx = AE_CONTEXT(ctx);
 
@@ -1822,11 +1823,10 @@ _ae_invalidate_state(struct gl_context *ctx, GLbitfield new_state)
     * Luckily, neither the drivers nor tnl muck with the state that
     * concerns us here:
     */
-   new_state &= _NEW_ARRAY | _NEW_PROGRAM;
-   if (new_state) {
-      assert(!actx->mapped_vbos);
-      actx->NewState |= new_state;
-   }
+   assert(ctx->NewState & (_NEW_ARRAY | _NEW_PROGRAM));
+
+   assert(!actx->mapped_vbos);
+   actx->dirty_state = true;
 }
 
 
diff --git a/src/mesa/main/api_arrayelt.h b/src/mesa/main/api_arrayelt.h
index 9ae79a94b7..965e0ad3ae 100644
--- a/src/mesa/main/api_arrayelt.h
+++ b/src/mesa/main/api_arrayelt.h
@@ -33,7 +33,7 @@
 
 extern GLboolean _ae_create_context( struct gl_context *ctx );
 extern void _ae_destroy_context( struct gl_context *ctx );
-extern void _ae_invalidate_state( struct gl_context *ctx, GLbitfield new_state );
+extern void _ae_invalidate_state(struct gl_context *ctx);
 extern bool _ae_is_state_dirty(struct gl_context *ctx);
 extern void GLAPIENTRY _ae_ArrayElement( GLint elt );
 
diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h
index 0418643f8f..2a762c85c6 100644
--- a/src/mesa/vbo/vbo_context.h
+++ b/src/mesa/vbo/vbo_context.h
@@ -98,14 +98,15 @@ vbo_exec_invalidate_state(struct gl_context *ctx)
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_exec_context *exec = &vbo->exec;
 
-   if (!exec->validating && ctx->NewState & (_NEW_PROGRAM | _NEW_ARRAY)) {
-      exec->array.recalculate_inputs = GL_TRUE;
+   if (ctx->NewState & (_NEW_PROGRAM | _NEW_ARRAY)) {
+      if (!exec->validating)
+         exec->array.recalculate_inputs = GL_TRUE;
+
+      _ae_invalidate_state(ctx);
    }
 
    if (ctx->NewState & _NEW_EVAL)
       exec->eval.recalculate_maps = GL_TRUE;
-
-   _ae_invalidate_state(ctx, ctx->NewState);
 }
 
 




More information about the mesa-commit mailing list