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;
-- 
2.1.4

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

Reply via email to