summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl/t_context.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-03-31 18:19:56 +0000
committerBrian Paul <[email protected]>2003-03-31 18:19:56 +0000
commit05b26510668fc1e5039c6c9088247f9b3c508cb7 (patch)
tree71a4fea8cdef352f9265b9081adf866e82925dc4 /src/mesa/tnl/t_context.h
parent55b0ff2193ab772249442712381908f6503508e5 (diff)
reduce memory needed for vertex attributes (allocate on demand)
Diffstat (limited to 'src/mesa/tnl/t_context.h')
-rw-r--r--src/mesa/tnl/t_context.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index d08da93abdb..b7153c545f5 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -1,4 +1,4 @@
-/* $Id: t_context.h,v 1.45 2003/03/28 01:39:04 brianp Exp $ */
+/* $Id: t_context.h,v 1.46 2003/03/31 18:19:56 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -192,16 +192,12 @@ struct immediate
GLuint PrimitiveLength[IMM_SIZE]; /* BEGIN/END */
GLuint Flag[IMM_SIZE]; /* VERT_BIT_* flags */
- /* All vertex attributes (position, normal, color, secondary color,
- * texcoords, fog coord) are stored in the Attrib[] arrays instead
- * of individual arrays as we did prior to Mesa 4.1.
- *
- * XXX may need to use 32-byte aligned allocation for this!!!
- * XXX replace this with GLfloat *Attrib[VERT_ATTRIB_MAX] and allocate
- * the attribute arrays as needed, so save memory. As is, we're using
- * 256 bytes per vertex (16 attribs * 4 comps/attrib * 4 bytes/comp).
+ /* Attrib is an array [MAX_VERT_ATTRIBS] of pointer to array [][4]
+ * of GLfloat.
+ * We only pre-allocate the vertex position array. The other vertex
+ * attribute arrays are only allocated when needed to save memory.
*/
- GLfloat Attrib[VERT_ATTRIB_MAX][IMM_SIZE][4]; /* GL_NV_vertex_program */
+ GLfloat (*Attrib[VERT_ATTRIB_MAX])[4];
GLfloat *NormalLengthPtr; /* length of normal vectors (display list only) */
@@ -213,16 +209,16 @@ struct immediate
struct vertex_arrays
{
- /* XXX move a bunch of these fields into the Attribs[] array??? */
+ /* Conventional vertex attribute arrays */
GLvector4f Obj;
GLvector4f Normal;
struct gl_client_array Color;
struct gl_client_array SecondaryColor;
- GLvector1ui Index;
- GLvector1ub EdgeFlag;
+ GLvector4f FogCoord;
GLvector4f TexCoord[MAX_TEXTURE_COORD_UNITS];
+ GLvector1ub EdgeFlag;
+ GLvector1ui Index;
GLvector1ui Elt;
- GLvector4f FogCoord;
/* These attributes don't alias with the conventional attributes.
* The GL_NV_vertex_program extension defines 16 extra sets of vertex