diff options
author | Brian Paul <[email protected]> | 2003-03-31 18:19:56 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-03-31 18:19:56 +0000 |
commit | 05b26510668fc1e5039c6c9088247f9b3c508cb7 (patch) | |
tree | 71a4fea8cdef352f9265b9081adf866e82925dc4 /src/mesa/tnl/t_imm_eval.c | |
parent | 55b0ff2193ab772249442712381908f6503508e5 (diff) |
reduce memory needed for vertex attributes (allocate on demand)
Diffstat (limited to 'src/mesa/tnl/t_imm_eval.c')
-rw-r--r-- | src/mesa/tnl/t_imm_eval.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c index f9f942aeea0..3b92d2a1740 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) { |