[Mesa-dev] [PATCH 036/101] mesa: add delete_vertex_arrays() helper

Timothy Arceri tarceri at itsqueeze.com
Sun Jul 23 23:44:45 UTC 2017



On 22/07/17 03:39, Samuel Pitoiset wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/mesa/main/arrayobj.c | 24 ++++++++++++++++--------
>   1 file changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
> index 77c0206ecf..60a24663f7 100644
> --- a/src/mesa/main/arrayobj.c
> +++ b/src/mesa/main/arrayobj.c
> @@ -466,17 +466,11 @@ _mesa_BindVertexArray(GLuint id)
>    * \param n      Number of array objects to delete.
>    * \param ids    Array of \c n array object IDs.
>    */
> -void GLAPIENTRY
> -_mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
> +static void
> +delete_vertex_arrays(struct gl_context *ctx, GLsizei n, const GLuint *ids)
>   {
> -   GET_CURRENT_CONTEXT(ctx);
>      GLsizei i;
>   
> -   if (n < 0) {
> -      _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArray(n)");
> -      return;
> -   }
> -
>      for (i = 0; i < n; i++) {
>         struct gl_vertex_array_object *obj = _mesa_lookup_vao(ctx, ids[i]);

Inside this loop there is a call:

    _mesa_BindVertexArray(0);

Because the id is always 0 this can be replaced with:

    _mesa_BindVertexArray_no_error(0);

With a follow-up patch that makes this change, that patch and 27-37 are:

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>



>   
> @@ -505,6 +499,20 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
>   }
>   
>   
> +void GLAPIENTRY
> +_mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   if (n < 0) {
> +      _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArray(n)");
> +      return;
> +   }
> +
> +   delete_vertex_arrays(ctx, n, ids);
> +}
> +
> +
>   /**
>    * Generate a set of unique array object IDs and store them in \c arrays.
>    * Helper for _mesa_GenVertexArrays() and _mesa_CreateVertexArrays()
> 


More information about the mesa-dev mailing list