summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_imm_elt.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_elt.c
parent55b0ff2193ab772249442712381908f6503508e5 (diff)
reduce memory needed for vertex attributes (allocate on demand)
Diffstat (limited to 'src/mesa/tnl/t_imm_elt.c')
-rw-r--r--src/mesa/tnl/t_imm_elt.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c
index c5f740373e..7b3972af2a 100644
--- a/src/mesa/tnl/t_imm_elt.c
+++ b/src/mesa/tnl/t_imm_elt.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_elt.c,v 1.21 2003/03/01 01:50:27 brianp Exp $ */
+/* $Id: t_imm_elt.c,v 1.22 2003/03/31 18:19:56 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -755,7 +755,7 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
GLuint *flags = IM->Flag;
GLuint *elts = IM->Elt;
GLuint translate = ctx->Array._Enabled;
- GLuint i;
+ GLuint i, attr;
if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
_mesa_debug(ctx, "exec_array_elements %d .. %d\n", start, count);
@@ -772,6 +772,17 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
translate |= VERT_BITS_OBJ_23;
}
+ /* Allocate destination attribute arrays if needed */
+ for (attr = 1; attr < VERT_ATTRIB_MAX; attr++) {
+ if ((translate & (1 << attr)) && !IM->Attrib[attr]) {
+ IM->Attrib[attr] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
+ if (!IM->Attrib[attr]) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "vertex processing2");
+ return;
+ }
+ }
+ }
+
if (translate & VERT_BIT_NORMAL)
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_NORMAL],