On Monday, July 06, 2015 11:33:20 AM Chris Wilson 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().
> 
> Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
> Cc: Kenneth Graunke <kenn...@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));
> +
>     tnl->Driver.Render.Start = _swsetup_RenderStart;
>     tnl->Driver.Render.Finish = _swsetup_RenderFinish;
>     tnl->Driver.Render.PrimitiveNotify = _swsetup_RenderPrimitive;
> 

Looks reasonable - this saves 2.59MB of memory in Piglit's glsl-cos
test.  (It's worth noting that in the commit message.)

I wonder if we can do better though by avoiding most of the
swrast context entirely...

Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to