diff options
author | Brian Paul <[email protected]> | 2000-06-27 22:10:00 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-06-27 22:10:00 +0000 |
commit | 2d8db39301349f67e17fc1b21e5d33d5f44cd521 (patch) | |
tree | c877df2f77ecd09fa50e526101198643bbeba473 /src/mesa/main/matrix.c | |
parent | 24507ff6ab91a85f98da60745bd6585499968b60 (diff) |
added aligned memory allocations (Gareth Hughes)
Diffstat (limited to 'src/mesa/main/matrix.c')
-rw-r--r-- | src/mesa/main/matrix.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 5eb5bb43f0c..5db2542a6e8 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.17 2000/04/08 18:57:45 brianp Exp $ */ +/* $Id: matrix.c,v 1.18 2000/06/27 22:10:00 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1562,16 +1562,23 @@ void gl_calculate_model_project_matrix( GLcontext *ctx ) void gl_matrix_ctr( GLmatrix *m ) { + if ( m->m == 0 ) { + m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + } + MEMCPY( m->m, Identity, sizeof(Identity) ); m->inv = 0; - MEMCPY( m->m, Identity, sizeof(Identity)); m->type = MATRIX_IDENTITY; m->flags = MAT_DIRTY_DEPENDENTS; } void gl_matrix_dtr( GLmatrix *m ) { - if (m->inv != 0) { - FREE(m->inv); + if ( m->m != 0 ) { + ALIGN_FREE( m->m ); + m->m = 0; + } + if ( m->inv != 0 ) { + ALIGN_FREE( m->inv ); m->inv = 0; } } @@ -1579,7 +1586,7 @@ void gl_matrix_dtr( GLmatrix *m ) #if 0 void gl_matrix_set_identity( GLmatrix *m ) { - MEMCPY( m->m, Identity, sizeof(Identity)); + MEMCPY( m->m, Identity, sizeof(Identity) ); m->type = MATRIX_IDENTITY; m->flags = MAT_DIRTY_DEPENDENTS; } @@ -1587,15 +1594,15 @@ void gl_matrix_set_identity( GLmatrix *m ) void gl_matrix_alloc_inv( GLmatrix *m ) { - if (m->inv == 0) { - m->inv = (GLfloat *)MALLOC(16*sizeof(GLfloat)); + if ( m->inv == 0 ) { + m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) ); } } void gl_matrix_copy( GLmatrix *to, const GLmatrix *from ) { - MEMCPY( to->m, from->m, sizeof(Identity)); + MEMCPY( to->m, from->m, sizeof(Identity) ); to->flags = from->flags | MAT_DIRTY_DEPENDENTS; to->type = from->type; |