From ae0eaf93e092ac8e8b1c98f3e986de96940663fa Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 24 Nov 2003 15:23:18 +0000 Subject: Merge vtx-0-2-branch --- src/mesa/math/m_vector.c | 239 ----------------------------------------------- src/mesa/math/m_vector.h | 126 ------------------------- 2 files changed, 365 deletions(-) (limited to 'src/mesa/math') diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index e01c87d67d..3ad81d468b 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -88,68 +88,7 @@ void _mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) v->flags = size_bits[4] | flags ; } -void _mesa_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] ) -{ - v->stride = 3 * sizeof(GLfloat); - v->data = storage; - v->start = (GLfloat *) storage; - v->count = 0; - v->flags = flags ; -} -void _mesa_vector1f_init( GLvector1f *v, GLuint flags, GLfloat *storage ) -{ - v->stride = 1*sizeof(GLfloat); - v->data = storage; - v->start = (GLfloat *)storage; - v->count = 0; - v->flags = flags ; -} - -void _mesa_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] ) -{ - v->stride = 4 * sizeof(GLubyte); - v->data = storage; - v->start = (GLubyte *) storage; - v->count = 0; - v->flags = flags ; -} - -void _mesa_vector4chan_init( GLvector4chan *v, GLuint flags, GLchan (*storage)[4] ) -{ - v->stride = 4 * sizeof(GLchan); - v->data = storage; - v->start = (GLchan *) storage; - v->count = 0; - v->flags = flags ; -} - -void _mesa_vector4us_init( GLvector4us *v, GLuint flags, GLushort (*storage)[4] ) -{ - v->stride = 4 * sizeof(GLushort); - v->data = storage; - v->start = (GLushort *) storage; - v->count = 0; - v->flags = flags ; -} - -void _mesa_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage ) -{ - v->stride = 1 * sizeof(GLubyte); - v->data = storage; - v->start = (GLubyte *) storage; - v->count = 0; - v->flags = flags ; -} - -void _mesa_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage ) -{ - v->stride = 1 * sizeof(GLuint); - v->data = storage; - v->start = (GLuint *) storage; - v->count = 0; - v->flags = flags ; -} /* @@ -174,82 +113,6 @@ void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, v->flags = size_bits[4] | flags | VEC_MALLOC ; } -void _mesa_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count, - GLuint alignment ) -{ - v->stride = 3 * sizeof(GLfloat); - v->storage = ALIGN_MALLOC( count * 3 * sizeof(GLfloat), alignment ); - v->start = (GLfloat *) v->storage; - v->data = (GLfloat (*)[3]) v->storage; - v->count = 0; - v->flags = flags | VEC_MALLOC ; -} - -void _mesa_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count, - GLuint alignment ) -{ - v->stride = sizeof(GLfloat); - v->storage = v->start = (GLfloat *) - ALIGN_MALLOC( count * sizeof(GLfloat), alignment ); - v->data = v->start; - v->count = 0; - v->flags = flags | VEC_MALLOC ; -} - -void _mesa_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, - GLuint alignment ) -{ - v->stride = 4 * sizeof(GLubyte); - v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLubyte), alignment ); - v->start = (GLubyte *) v->storage; - v->data = (GLubyte (*)[4]) v->storage; - v->count = 0; - v->flags = flags | VEC_MALLOC ; -} - -void _mesa_vector4chan_alloc( GLvector4chan *v, GLuint flags, GLuint count, - GLuint alignment ) -{ - v->stride = 4 * sizeof(GLchan); - v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLchan), alignment ); - v->start = (GLchan *) v->storage; - v->data = (GLchan (*)[4]) v->storage; - v->count = 0; - v->flags = flags | VEC_MALLOC ; -} - -void _mesa_vector4us_alloc( GLvector4us *v, GLuint flags, GLuint count, - GLuint alignment ) -{ - v->stride = 4 * sizeof(GLushort); - v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLushort), alignment ); - v->start = (GLushort *) v->storage; - v->data = (GLushort (*)[4]) v->storage; - v->count = 0; - v->flags = flags | VEC_MALLOC ; -} - -void _mesa_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count, - GLuint alignment ) -{ - v->stride = 1 * sizeof(GLubyte); - v->storage = ALIGN_MALLOC( count * sizeof(GLubyte), alignment ); - v->start = (GLubyte *) v->storage; - v->data = (GLubyte *) v->storage; - v->count = 0; - v->flags = flags | VEC_MALLOC ; -} - -void _mesa_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count, - GLuint alignment ) -{ - v->stride = 1 * sizeof(GLuint); - v->storage = ALIGN_MALLOC( count * sizeof(GLuint), alignment ); - v->start = (GLuint *) v->storage; - v->data = (GLuint *) v->storage; - v->count = 0; - v->flags = flags | VEC_MALLOC ; -} @@ -271,83 +134,6 @@ void _mesa_vector4f_free( GLvector4f *v ) } } -void _mesa_vector3f_free( GLvector3f *v ) -{ - if (v->flags & VEC_MALLOC) { - ALIGN_FREE( v->storage ); - v->data = 0; - v->start = 0; - v->storage = 0; - v->flags &= ~VEC_MALLOC; - } -} - -void _mesa_vector1f_free( GLvector1f *v ) -{ - if (v->flags & VEC_MALLOC) { - ALIGN_FREE( v->storage ); - v->data = NULL; - v->start = NULL; - v->storage = NULL; - v->flags &= ~VEC_MALLOC; - } -} - -void _mesa_vector4ub_free( GLvector4ub *v ) -{ - if (v->flags & VEC_MALLOC) { - ALIGN_FREE( v->storage ); - v->data = NULL; - v->start = NULL; - v->storage = NULL; - v->flags &= ~VEC_MALLOC; - } -} - -void _mesa_vector4chan_free( GLvector4chan *v ) -{ - if (v->flags & VEC_MALLOC) { - ALIGN_FREE( v->storage ); - v->data = NULL; - v->start = NULL; - v->storage = NULL; - v->flags &= ~VEC_MALLOC; - } -} - -void _mesa_vector4us_free( GLvector4us *v ) -{ - if (v->flags & VEC_MALLOC) { - ALIGN_FREE( v->storage ); - v->data = NULL; - v->start = NULL; - v->storage = NULL; - v->flags &= ~VEC_MALLOC; - } -} - -void _mesa_vector1ub_free( GLvector1ub *v ) -{ - if (v->flags & VEC_MALLOC) { - ALIGN_FREE( v->storage ); - v->data = NULL; - v->start = NULL; - v->storage = NULL; - v->flags &= ~VEC_MALLOC; - } -} - -void _mesa_vector1ui_free( GLvector1ui *v ) -{ - if (v->flags & VEC_MALLOC) { - ALIGN_FREE( v->storage ); - v->data = NULL; - v->start = NULL; - v->storage = NULL; - v->flags &= ~VEC_MALLOC; - } -} - /* * For debugging @@ -402,28 +188,3 @@ void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) } -/* - * For debugging - */ -void _mesa_vector3f_print( GLvector3f *v, GLubyte *cullmask, GLboolean culling ) -{ - GLfloat *d = (GLfloat *)v->data; - GLuint i = 0, count; - - _mesa_printf("data-start\n"); - for ( ; d != v->start ; STRIDE_F(d,v->stride), i++) - _mesa_printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); - - _mesa_printf("start-count(%u)\n", v->count); - count = i + v->count; - - if (culling) { - for ( ; i < count ; STRIDE_F(d,v->stride), i++) - if (cullmask[i]) - _mesa_printf("%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); - } - else { - for ( ; i < count ; STRIDE_F(d,v->stride), i++) - _mesa_printf("%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); - } -} diff --git a/src/mesa/math/m_vector.h b/src/mesa/math/m_vector.h index 4b1b643ea7..222b47f6e1 100644 --- a/src/mesa/math/m_vector.h +++ b/src/mesa/math/m_vector.h @@ -80,132 +80,6 @@ extern void _mesa_vector4f_print( GLvector4f *v, GLubyte *, GLboolean ); extern void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint nr, GLuint elt ); -/* Could use a single vector type for normals and vertices, but - * this way avoids some casts. - */ -typedef struct { - GLfloat (*data)[3]; - GLfloat *start; - GLuint count; - GLuint stride; - GLuint flags; - void *storage; -} GLvector3f; - -extern void _mesa_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*)[3] ); -extern void _mesa_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count, - GLuint alignment ); -extern void _mesa_vector3f_free( GLvector3f *v ); -extern void _mesa_vector3f_print( GLvector3f *v, GLubyte *, GLboolean ); - - -typedef struct { - GLfloat *data; - GLfloat *start; - GLuint count; - GLuint stride; - GLuint flags; - void *storage; -} GLvector1f; - -extern void _mesa_vector1f_free( GLvector1f *v ); -extern void _mesa_vector1f_init( GLvector1f *v, GLuint flags, GLfloat * ); -extern void _mesa_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count, - GLuint alignment ); - - -/* For 4ub rgba values. - */ -typedef struct { - GLubyte (*data)[4]; - GLubyte *start; - GLuint count; - GLuint stride; - GLuint flags; - void *storage; -} GLvector4ub; - -extern void _mesa_vector4ub_init( GLvector4ub *v, GLuint flags, - GLubyte (*storage)[4] ); -extern void _mesa_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, - GLuint alignment ); -extern void _mesa_vector4ub_free( GLvector4ub * ); - - -/* For 4 * GLchan values. - */ -typedef struct { - GLchan (*data)[4]; - GLchan *start; - GLuint count; - GLuint stride; - GLuint flags; - void *storage; -} GLvector4chan; - -extern void _mesa_vector4chan_init( GLvector4chan *v, GLuint flags, - GLchan (*storage)[4] ); -extern void _mesa_vector4chan_alloc( GLvector4chan *v, GLuint flags, GLuint count, - GLuint alignment ); -extern void _mesa_vector4chan_free( GLvector4chan * ); - - - - -/* For 4 * GLushort rgba values. - */ -typedef struct { - GLushort (*data)[4]; - GLushort *start; - GLuint count; - GLuint stride; - GLuint flags; - void *storage; -} GLvector4us; - -extern void _mesa_vector4us_init( GLvector4us *v, GLuint flags, - GLushort (*storage)[4] ); -extern void _mesa_vector4us_alloc( GLvector4us *v, GLuint flags, GLuint count, - GLuint alignment ); -extern void _mesa_vector4us_free( GLvector4us * ); - - - - -/* For 1ub values, eg edgeflag. - */ -typedef struct { - GLubyte *data; - GLubyte *start; - GLuint count; - GLuint stride; - GLuint flags; - void *storage; -} GLvector1ub; - -extern void _mesa_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage); -extern void _mesa_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count, - GLuint alignment ); -extern void _mesa_vector1ub_free( GLvector1ub * ); - - - - -/* For, eg Index, Array element. - */ -typedef struct { - GLuint *data; - GLuint *start; - GLuint count; - GLuint stride; - GLuint flags; - void *storage; -} GLvector1ui; - -extern void _mesa_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage ); -extern void _mesa_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count, - GLuint alignment ); -extern void _mesa_vector1ui_free( GLvector1ui * ); -- cgit v1.2.3