From 05b26510668fc1e5039c6c9088247f9b3c508cb7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 31 Mar 2003 18:19:56 +0000 Subject: reduce memory needed for vertex attributes (allocate on demand) --- src/mesa/tnl/t_imm_eval.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/mesa/tnl/t_imm_eval.c') diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c index f9f942aeea..3b92d2a174 100644 --- a/src/mesa/tnl/t_imm_eval.c +++ b/src/mesa/tnl/t_imm_eval.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_eval.c,v 1.28 2003/03/01 01:50:27 brianp Exp $ */ +/* $Id: t_imm_eval.c,v 1.29 2003/03/31 18:19:57 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -453,6 +453,7 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ) GLuint req = 0; GLuint purge_flags = 0; GLfloat (*coord)[4] = IM->Attrib[VERT_ATTRIB_POS] + IM->CopyStart; + GLuint attr; if (IM->AndFlag & VERT_BITS_EVAL_ANY) copycount = IM->Start - IM->CopyStart; /* just copy copied vertices */ @@ -503,6 +504,18 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ) } } + /* Allocate vertex attribute storage now */ + for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { + if ((req & (1 << attr)) && !store->Attrib[attr]) { + store->Attrib[attr] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat)); + if (!store->Attrib[attr]) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "evaluator processing"); + return; + } + } + } + + /* Perform the evaluations on active data elements. */ if (req & VERT_BIT_INDEX) { -- cgit v1.2.3