[Mesa-dev] [PATCH 4/9] mesa: Rename _mesa_..._array_obj functions to _mesa_..._vao.

Kenneth Graunke kenneth at whitecape.org
Sat Feb 1 22:30:08 PST 2014


_mesa_update_vao_client_arrays() is less of a mouthful than
_mesa_update_array_object_client_arrays(), and generally clearer.

Generated by:
$ find . -type f -print0 | xargs -0 sed -i \
  's/_mesa_\([^_]*\)_array_object/_mesa_\1_vao/g'
with manual whitespace and indentation fixes applied.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/common/driverfuncs.c        |  4 ++--
 src/mesa/drivers/common/meta.c               |  4 ++--
 src/mesa/main/api_arrayelt.c                 |  2 +-
 src/mesa/main/arrayobj.c                     | 32 ++++++++++++++--------------
 src/mesa/main/arrayobj.h                     | 30 +++++++++++++-------------
 src/mesa/main/attrib.c                       |  4 ++--
 src/mesa/main/context.c                      |  4 ++--
 src/mesa/main/state.c                        |  4 ++--
 src/mesa/main/varray.c                       |  7 +++---
 src/mesa/state_tracker/st_cb_bufferobjects.c |  4 ++--
 10 files changed, 47 insertions(+), 48 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 6d56838..6ece5d8 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -180,8 +180,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
    _mesa_init_texture_barrier_functions(driver);
 
    /* APPLE_vertex_array_object */
-   driver->NewArrayObject = _mesa_new_array_object;
-   driver->DeleteArrayObject = _mesa_delete_array_object;
+   driver->NewArrayObject = _mesa_new_vao;
+   driver->DeleteArrayObject = _mesa_delete_vao;
    driver->BindArrayObject = NULL;
 
    _mesa_init_shader_object_functions(driver);
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index dd9b4a7..f27c686 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -726,7 +726,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 
    if (state & MESA_META_VERTEX) {
       /* save vertex array object state */
-      _mesa_reference_array_object(ctx, &save->VAO,
+      _mesa_reference_vao(ctx, &save->VAO,
                                    ctx->Array.VAO);
       _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj,
                                     ctx->Array.ArrayBufferObj);
@@ -1093,7 +1093,7 @@ _mesa_meta_end(struct gl_context *ctx)
 
       /* restore vertex array object */
       _mesa_BindVertexArray(save->VAO->Name);
-      _mesa_reference_array_object(ctx, &save->VAO, NULL);
+      _mesa_reference_vao(ctx, &save->VAO, NULL);
    }
 
    if (state & MESA_META_VIEWPORT) {
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index 981231c..fdda1dc 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1475,7 +1475,7 @@ update_derived_client_arrays(struct gl_context *ctx)
    struct gl_vertex_array_object *vao = ctx->Array.VAO;
 
    if (vao->NewArrays) {
-      _mesa_update_array_object_client_arrays(ctx, vao);
+      _mesa_update_vao_client_arrays(ctx, vao);
       vao->NewArrays = 0;
    }
 }
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index ca85bc3..dde9cf9 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -96,11 +96,11 @@ unbind_array_object_vbos(struct gl_context *ctx, struct gl_vertex_array_object *
  * \c dd_function_table::NewArrayObject.
  */
 struct gl_vertex_array_object *
-_mesa_new_array_object( struct gl_context *ctx, GLuint name )
+_mesa_new_vao(struct gl_context *ctx, GLuint name)
 {
    struct gl_vertex_array_object *obj = CALLOC_STRUCT(gl_vertex_array_object);
    if (obj)
-      _mesa_initialize_array_object(ctx, obj, name);
+      _mesa_initialize_vao(ctx, obj, name);
    return obj;
 }
 
@@ -112,7 +112,7 @@ _mesa_new_array_object( struct gl_context *ctx, GLuint name )
  * \c dd_function_table::DeleteArrayObject.
  */
 void
-_mesa_delete_array_object( struct gl_context *ctx, struct gl_vertex_array_object *obj )
+_mesa_delete_vao(struct gl_context *ctx, struct gl_vertex_array_object *obj)
 {
    (void) ctx;
    unbind_array_object_vbos(ctx, obj);
@@ -125,13 +125,13 @@ _mesa_delete_array_object( struct gl_context *ctx, struct gl_vertex_array_object
 
 /**
  * Set ptr to vao w/ reference counting.
- * Note: this should only be called from the _mesa_reference_array_object()
+ * Note: this should only be called from the _mesa_reference_vao()
  * inline function.
  */
 void
-_mesa_reference_array_object_(struct gl_context *ctx,
-                              struct gl_vertex_array_object **ptr,
-                              struct gl_vertex_array_object *vao)
+_mesa_reference_vao_(struct gl_context *ctx,
+                     struct gl_vertex_array_object **ptr,
+                     struct gl_vertex_array_object *vao)
 {
    assert(*ptr != vao);
 
@@ -216,9 +216,9 @@ init_array(struct gl_context *ctx,
  * Initialize a gl_vertex_array_object's arrays.
  */
 void
-_mesa_initialize_array_object( struct gl_context *ctx,
-			       struct gl_vertex_array_object *obj,
-			       GLuint name )
+_mesa_initialize_vao(struct gl_context *ctx,
+                     struct gl_vertex_array_object *obj,
+                     GLuint name)
 {
    GLuint i;
 
@@ -291,7 +291,7 @@ remove_array_object( struct gl_context *ctx, struct gl_vertex_array_object *obj
 
 
 /**
- * Helper for _mesa_update_array_object_max_element().
+ * Helper for _mesa_update_vao_max_element().
  * \return  min(vao->_VertexAttrib[*]._MaxElement).
  */
 static GLuint
@@ -318,7 +318,7 @@ compute_max_element(struct gl_vertex_array_object *vao, GLbitfield64 enabled)
  * Examine vertex arrays to update the gl_vertex_array_object::_MaxElement field.
  */
 void
-_mesa_update_array_object_max_element(struct gl_context *ctx,
+_mesa_update_vao_max_element(struct gl_context *ctx,
                                       struct gl_vertex_array_object *vao)
 {
    GLbitfield64 enabled;
@@ -340,8 +340,8 @@ _mesa_update_array_object_max_element(struct gl_context *ctx,
  * or a gl_vertex_buffer_binding has changed.
  */
 void
-_mesa_update_array_object_client_arrays(struct gl_context *ctx,
-                                        struct gl_vertex_array_object *vao)
+_mesa_update_vao_client_arrays(struct gl_context *ctx,
+                               struct gl_vertex_array_object *vao)
 {
    GLbitfield64 arrays = vao->NewArrays;
 
@@ -426,7 +426,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
    }
 
    ctx->NewState |= _NEW_ARRAY;
-   _mesa_reference_array_object(ctx, &ctx->Array.VAO, newObj);
+   _mesa_reference_vao(ctx, &ctx->Array.VAO, newObj);
 
    /* Pass BindVertexArray call to device driver */
    if (ctx->Driver.BindArrayObject && newObj)
@@ -501,7 +501,7 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
          /* Unreference the array object. 
           * If refcount hits zero, the object will be deleted.
           */
-         _mesa_reference_array_object(ctx, &obj, NULL);
+         _mesa_reference_vao(ctx, &obj, NULL);
       }
    }
 }
diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
index 722708e..6511e08 100644
--- a/src/mesa/main/arrayobj.h
+++ b/src/mesa/main/arrayobj.h
@@ -49,38 +49,38 @@ extern struct gl_vertex_array_object *
 _mesa_lookup_arrayobj(struct gl_context *ctx, GLuint id);
 
 extern struct gl_vertex_array_object *
-_mesa_new_array_object( struct gl_context *ctx, GLuint name );
+_mesa_new_vao(struct gl_context *ctx, GLuint name);
 
 extern void
-_mesa_delete_array_object( struct gl_context *ctx, struct gl_vertex_array_object *obj );
+_mesa_delete_vao(struct gl_context *ctx, struct gl_vertex_array_object *obj);
 
 extern void
-_mesa_reference_array_object_(struct gl_context *ctx,
-                              struct gl_vertex_array_object **ptr,
-                              struct gl_vertex_array_object *vao);
+_mesa_reference_vao_(struct gl_context *ctx,
+                     struct gl_vertex_array_object **ptr,
+                     struct gl_vertex_array_object *vao);
 
 static inline void
-_mesa_reference_array_object(struct gl_context *ctx,
-                             struct gl_vertex_array_object **ptr,
-                             struct gl_vertex_array_object *vao)
+_mesa_reference_vao(struct gl_context *ctx,
+                    struct gl_vertex_array_object **ptr,
+                    struct gl_vertex_array_object *vao)
 {
    if (*ptr != vao)
-      _mesa_reference_array_object_(ctx, ptr, vao);
+      _mesa_reference_vao_(ctx, ptr, vao);
 }
 
 
 extern void
-_mesa_initialize_array_object( struct gl_context *ctx,
-                               struct gl_vertex_array_object *obj, GLuint name );
+_mesa_initialize_vao(struct gl_context *ctx,
+                     struct gl_vertex_array_object *obj, GLuint name);
 
 
 extern void
-_mesa_update_array_object_max_element(struct gl_context *ctx,
-                                      struct gl_vertex_array_object *vao);
+_mesa_update_vao_max_element(struct gl_context *ctx,
+                             struct gl_vertex_array_object *vao);
 
 extern void
-_mesa_update_array_object_client_arrays(struct gl_context *ctx,
-                                        struct gl_vertex_array_object *vao);
+_mesa_update_vao_client_arrays(struct gl_context *ctx,
+                               struct gl_vertex_array_object *vao);
 
 
 /** Returns the bitmask of all enabled arrays in fixed function mode.
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 5c31379..5b5c48d 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1574,7 +1574,7 @@ init_array_attrib_data(struct gl_context *ctx,
       return false;
    }
 
-   _mesa_initialize_array_object(ctx, attrib->VAO, 0);
+   _mesa_initialize_vao(ctx, attrib->VAO, 0);
    return true;
 }
 
@@ -1589,7 +1589,7 @@ free_array_attrib_data(struct gl_context *ctx,
 {
    /* We use a non driver array object, so don't just unref since we would
     * end up using the drivers DeleteArrayObject function for deletion. */
-   _mesa_delete_array_object(ctx, attrib->VAO);
+   _mesa_delete_vao(ctx, attrib->VAO);
    attrib->VAO = 0;
    _mesa_reference_buffer_object(ctx, &attrib->ArrayBufferObj, NULL);
 }
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b8c02d0..d0a1449 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1188,8 +1188,8 @@ _mesa_free_context_data( struct gl_context *ctx )
    _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
    _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL);
 
-   _mesa_reference_array_object(ctx, &ctx->Array.VAO, NULL);
-   _mesa_reference_array_object(ctx, &ctx->Array.DefaultVAO, NULL);
+   _mesa_reference_vao(ctx, &ctx->Array.VAO, NULL);
+   _mesa_reference_vao(ctx, &ctx->Array.DefaultVAO, NULL);
 
    _mesa_free_attrib_data(ctx);
    _mesa_free_buffer_objects(ctx);
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index b6593dd..0866a14 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -417,11 +417,11 @@ _mesa_update_state_locked( struct gl_context *ctx )
    }
 
    if (new_state & _NEW_ARRAY)
-      _mesa_update_array_object_client_arrays(ctx, ctx->Array.VAO);
+      _mesa_update_vao_client_arrays(ctx, ctx->Array.VAO);
 
    if (ctx->Const.CheckArrayBounds &&
        new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) {
-      _mesa_update_array_object_max_element(ctx, ctx->Array.VAO);
+      _mesa_update_vao_max_element(ctx, ctx->Array.VAO);
    }
 
  out:
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 068200c..44db2cb 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1761,7 +1761,7 @@ _mesa_print_arrays(struct gl_context *ctx)
    struct gl_vertex_array_object *vao = ctx->Array.VAO;
    GLuint i;
 
-   _mesa_update_array_object_max_element(ctx, vao);
+   _mesa_update_vao_max_element(ctx, vao);
 
    printf("Array Object %u\n", vao->Name);
    if (vao->_VertexAttrib[VERT_ATTRIB_POS].Enabled)
@@ -1787,8 +1787,7 @@ void
 _mesa_init_varray(struct gl_context *ctx)
 {
    ctx->Array.DefaultVAO = ctx->Driver.NewArrayObject(ctx, 0);
-   _mesa_reference_array_object(ctx, &ctx->Array.VAO,
-                                ctx->Array.DefaultVAO);
+   _mesa_reference_vao(ctx, &ctx->Array.VAO, ctx->Array.DefaultVAO);
    ctx->Array.ActiveTexture = 0;   /* GL_ARB_multitexture */
 
    ctx->Array.Objects = _mesa_NewHashTable();
@@ -1803,7 +1802,7 @@ delete_arrayobj_cb(GLuint id, void *data, void *userData)
 {
    struct gl_vertex_array_object *vao = (struct gl_vertex_array_object *) data;
    struct gl_context *ctx = (struct gl_context *) userData;
-   _mesa_delete_array_object(ctx, vao);
+   _mesa_delete_vao(ctx, vao);
 }
 
 
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index ac8d079..7a410c2 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -436,6 +436,6 @@ st_init_bufferobject_functions(struct dd_function_table *functions)
    functions->CopyBufferSubData = st_copy_buffer_subdata;
 
    /* For GL_APPLE_vertex_array_object */
-   functions->NewArrayObject = _mesa_new_array_object;
-   functions->DeleteArrayObject = _mesa_delete_array_object;
+   functions->NewArrayObject = _mesa_new_vao;
+   functions->DeleteArrayObject = _mesa_delete_vao;
 }
-- 
1.8.5.2



More information about the mesa-dev mailing list