summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_imm_alloc.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-03-31 18:19:56 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-03-31 18:19:56 +0000
commit05b26510668fc1e5039c6c9088247f9b3c508cb7 (patch)
tree71a4fea8cdef352f9265b9081adf866e82925dc4 /src/mesa/tnl/t_imm_alloc.c
parent55b0ff2193ab772249442712381908f6503508e5 (diff)
reduce memory needed for vertex attributes (allocate on demand)
Diffstat (limited to 'src/mesa/tnl/t_imm_alloc.c')
-rw-r--r--src/mesa/tnl/t_imm_alloc.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mesa/tnl/t_imm_alloc.c b/src/mesa/tnl/t_imm_alloc.c
index f0c31a7642..48a657028b 100644
--- a/src/mesa/tnl/t_imm_alloc.c
+++ b/src/mesa/tnl/t_imm_alloc.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_alloc.c,v 1.19 2003/03/29 17:09:42 brianp Exp $ */
+/* $Id: t_imm_alloc.c,v 1.20 2003/03/31 18:19:56 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -57,6 +57,20 @@ real_alloc_immediate( GLcontext *ctx )
immed->TexSize = 0;
immed->NormalLengthPtr = 0;
+ /* Only allocate space for vertex positions right now. Color, texcoord,
+ * etc storage will be allocated as needed.
+ */
+ immed->Attrib[VERT_ATTRIB_POS] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
+
+ /* Enable this to allocate all attribute arrays up front */
+ if (0)
+ {
+ int i;
+ for (i = 1; i < VERT_ATTRIB_MAX; i++) {
+ immed->Attrib[i] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
+ }
+ }
+
immed->CopyTexSize = 0;
immed->CopyStart = immed->Start;
@@ -68,6 +82,13 @@ static void
real_free_immediate( struct immediate *immed )
{
static int freed = 0;
+ GLuint i;
+
+ for (i =0; i < VERT_ATTRIB_MAX; i++) {
+ if (immed->Attrib[i])
+ _mesa_free(immed->Attrib[i]);
+ immed->Attrib[i] = NULL;
+ }
if (immed->Material) {
FREE( immed->Material );