[Mesa-dev] [PATCH 15/18] swrast: Defer _tnl_vertex_init until first use

Matt Turner mattst88 at gmail.com
Mon Jul 6 12:11:06 PDT 2015


On Mon, Jul 6, 2015 at 3:33 AM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> The vertices require a large chunk of memory, currently allocated during
> context creation. However, this memory is not required until use so we
> can defer the allocation until the first swrast_Wakeup().

Makes sense to me. Someone like Brian like to take a look.

>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/swrast_setup/ss_context.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
> index 74b1da3..028eccb 100644
> --- a/src/mesa/swrast_setup/ss_context.c
> +++ b/src/mesa/swrast_setup/ss_context.c
> @@ -59,10 +59,6 @@ _swsetup_CreateContext( struct gl_context *ctx )
>     swsetup->NewState = ~0;
>     _swsetup_trifuncs_init( ctx );
>
> -   _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
> -                      sizeof(SWvertex) );
> -
> -
>     return GL_TRUE;
>  }
>
> @@ -233,6 +229,11 @@ _swsetup_Wakeup( struct gl_context *ctx )
>     TNLcontext *tnl = TNL_CONTEXT(ctx);
>     SScontext *swsetup = SWSETUP_CONTEXT(ctx);
>
> +   if (!(GET_VERTEX_STATE(ctx))->max_vertex_size)
> +      _tnl_init_vertices(ctx,
> +                        ctx->Const.MaxArrayLockSize + 12,
> +                        sizeof(SWvertex));

Replace the tabs on these two lines with spaces.

> +
>     tnl->Driver.Render.Start = _swsetup_RenderStart;
>     tnl->Driver.Render.Finish = _swsetup_RenderFinish;
>     tnl->Driver.Render.PrimitiveNotify = _swsetup_RenderPrimitive;
> --
> 2.1.4


More information about the mesa-dev mailing list