[Mesa-dev] [PATCH] mesa: use array object constructor

Brian Paul brianp at vmware.com
Wed Apr 18 10:46:57 PDT 2012


On 04/18/2012 11:28 AM, Mathias Fröhlich wrote:
>
> Hi,
>
> The attached change uses the array object factory for gl_array_objects. This
> prevents crashes when deriving from gl_array_object.
> The change should be orthogonal to Mareks posted changes.
>
> Please Review.

>
> From 2f8f27281f44142edd258a62eff6be1fe7f413d8 Mon Sep 17 00:00:00 2001
> Message-Id: <2f8f27281f44142edd258a62eff6be1fe7f413d8.1334769748.git.Mathias.Froehlich at gmx.net>
> From: =?UTF-8?q?Mathias=20Fr=C3=B6hlich?= <Mathias.Froehlich at web.de>
> Date: Wed, 2 Nov 2011 19:54:26 +0100
> Subject: [PATCH] mesa: use array object constructor
>
> ---
>  src/mesa/main/context.c |    3 ++-
>  src/mesa/main/varray.c  |    2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 51b0241..a506981 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -1118,7 +1118,8 @@ _mesa_free_context_data( struct gl_context *ctx )
>     _mesa_free_varray_data(ctx);
>     _mesa_free_transform_feedback(ctx);
>
> -   _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj);
> +   _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, NULL);
> +   _mesa_reference_array_object(ctx, &ctx->Array.DefaultArrayObj, NULL);
>
>  #if FEATURE_ARB_pixel_buffer_object
>     _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj, NULL);
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index a402c7b..0237cdd 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -1221,7 +1221,7 @@ _mesa_print_arrays(struct gl_context *ctx)
>  void
>  _mesa_init_varray(struct gl_context *ctx)
>  {
> -   ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0);
> +   ctx->Array.DefaultArrayObj = (*ctx->Driver.NewArrayObject)(ctx, 0);

You can just use ctx->Driver.NewArrayObject(ctx, 0);


>     _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj,
>                                  ctx->Array.DefaultArrayObj);
>     ctx->Array.ActiveTexture = 0;   /* GL_ARB_multitexture */
> --
> 1.7.7.6
>

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list