diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/glapi/glapi.c | 16 | ||||
-rw-r--r-- | src/mesa/glapi/glapitable.h | 9 | ||||
-rw-r--r-- | src/mesa/glapi/glapitemp.h | 30 | ||||
-rw-r--r-- | src/mesa/main/dispatch.c | 10 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 43 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 3 | ||||
-rw-r--r-- | src/mesa/main/get.c | 123 | ||||
-rw-r--r-- | src/mesa/main/matrix.c | 82 | ||||
-rw-r--r-- | src/mesa/main/matrix.h | 23 |
9 files changed, 327 insertions, 12 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 2ca689e6e0a..25f05e547c9 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -1,4 +1,4 @@ -/* $Id: glapi.c,v 1.10 1999/11/27 21:30:40 brianp Exp $ */ +/* $Id: glapi.c,v 1.11 1999/12/10 20:01:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -652,6 +652,13 @@ static struct name_address_pair static_functions[] = { { "glResizeBuffersMESA", (GLvoid *) glResizeBuffersMESA }, #endif +#ifdef _GLAPI_ARB_transpose_matrix + { "glLoadTransposeMatrixdARB", (GLvoid *) glLoadTransposeMatrixdARB }, + { "glLoadTransposeMatrixfARB", (GLvoid *) glLoadTransposeMatrixfARB }, + { "glMultTransposeMatrixdARB", (GLvoid *) glMultTransposeMatrixdARB }, + { "glMultTransposeMatrixfARB", (GLvoid *) glMultTransposeMatrixfARB }, +#endif + { NULL, NULL } /* end of list marker */ }; @@ -1261,6 +1268,13 @@ _glapi_check_table(const struct _glapi_table *table) #ifdef _GLAPI_MESA_resize_buffers assert(table->ResizeBuffersMESA); #endif + +#ifdef _GLAPI_ARB_transpose_matrix + assert(table->LoadTransposeMatrixdARB); + assert(table->LoadTransposeMatrixfARB); + assert(table->MultTransposeMatrixdARB); + assert(table->MultTransposeMatrixfARB); +#endif } diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h index fb9555e4216..84273a5b1aa 100644 --- a/src/mesa/glapi/glapitable.h +++ b/src/mesa/glapi/glapitable.h @@ -1,4 +1,4 @@ -/* $Id: glapitable.h,v 1.2 1999/11/27 21:30:10 brianp Exp $ */ +/* $Id: glapitable.h,v 1.3 1999/12/10 20:01:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -63,6 +63,7 @@ #define _GLAPI_INGR_blend_func_separate 1 #define _GLAPI_MESA_window_pos 1 #define _GLAPI_MESA_resize_buffers 1 +#define _GLAPI_ARB_transpose_matrix 1 @@ -553,6 +554,12 @@ struct _glapi_table void (*ResizeBuffersMESA)(void); #endif +#ifdef _GLAPI_ARB_transpose_matrix + void (*LoadTransposeMatrixdARB)(const GLdouble m[16]); + void (*LoadTransposeMatrixfARB)(const GLfloat m[16]); + void (*MultTransposeMatrixdARB)(const GLdouble m[16]); + void (*MultTransposeMatrixfARB)(const GLfloat m[16]); +#endif void *ExtensionFuncs[_GLAPI_EXTRA_SLOTS]; }; diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index 7b8a3a159fc..32578ba66b2 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -1,4 +1,4 @@ -/* $Id: glapitemp.h,v 1.1 1999/11/25 18:16:13 brianp Exp $ */ +/* $Id: glapitemp.h,v 1.2 1999/12/10 20:01:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -2947,6 +2947,34 @@ KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) #endif /* GL_MESA_resize_buffers */ +#ifdef _GLAPI_ARB_transpose_matrix +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble m[16]) +{ + DISPATCH_SETUP; + DISPATCH(LoadTransposeMatrixdARB, (m)); +} + +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat m[16]) +{ + DISPATCH_SETUP; + DISPATCH(LoadTransposeMatrixfARB, (m)); +} + +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble m[16]) +{ + DISPATCH_SETUP; + DISPATCH(MultTransposeMatrixdARB, (m)); +} + +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat m[16]) +{ + DISPATCH_SETUP; + DISPATCH(MultTransposeMatrixfARB, (m)); +} + +#endif + + #undef KEYWORD1 #undef KEYWORD2 diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index ba65193941a..33cc485ab4e 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -1,4 +1,4 @@ -/* $Id: dispatch.c,v 1.5 1999/11/27 21:42:12 brianp Exp $ */ +/* $Id: dispatch.c,v 1.6 1999/12/10 20:01:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -575,5 +575,13 @@ _mesa_init_exec_table(struct _glapi_table *exec) #ifdef _GLAPI_MESA_resize_buffers exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; #endif + +#ifdef _GLAPI_ARB_transpose_matrix + exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB; + exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB; + exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB; + exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB; +#endif + } diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 14662773c6b..56e8b07fbce 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.20 1999/11/27 21:40:42 brianp Exp $ */ +/* $Id: dlist.c,v 1.21 1999/12/10 20:01:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -3068,6 +3068,39 @@ static void save_ClientActiveTextureARB( GLenum target ) +static void save_LoadTransposeMatrixdARB( const GLdouble m[16] ) +{ + GLdouble tm[16]; + gl_matrix_transposed(tm, m); + save_LoadMatrixd(tm); +} + + +static void save_LoadTransposeMatrixfARB( const GLfloat m[16] ) +{ + GLfloat tm[16]; + gl_matrix_transposef(tm, m); + save_LoadMatrixf(tm); +} + + +static void save_MultTransposeMatrixdARB( const GLdouble m[16] ) +{ + GLdouble tm[16]; + gl_matrix_transposed(tm, m); + save_MultMatrixd(tm); +} + + +static void save_MultTransposeMatrixfARB( const GLfloat m[16] ) +{ + GLfloat tm[16]; + gl_matrix_transposef(tm, m); + save_MultMatrixf(tm); +} + + + void gl_compile_cassette( GLcontext *ctx ) { Node *n = alloc_instruction( ctx, OPCODE_VERTEX_CASSETTE, 8 ); @@ -4462,6 +4495,14 @@ _mesa_init_dlist_table( struct _glapi_table *table ) #ifdef _GLAPI_MESA_resize_buffers table->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; #endif + +#ifdef _GLAPI_ARB_transpose_matrix + table->LoadTransposeMatrixdARB = save_LoadTransposeMatrixdARB; + table->LoadTransposeMatrixfARB = save_LoadTransposeMatrixfARB; + table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB; + table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB; +#endif + } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 102bb51599a..d7f09ba203e 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.15 1999/12/10 15:13:57 brianp Exp $ */ +/* $Id: extensions.c,v 1.16 1999/12/10 20:01:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -75,6 +75,7 @@ static struct { int enabled; const char *name; } default_extensions[] = { { DEFAULT_OFF, "GL_EXT_vertex_array_set" }, { DEFAULT_ON, "GL_EXT_clip_volume_hint" }, { DEFAULT_ON, "GL_EXT_texture_env_add" }, + { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" }, }; diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 165b9589ed5..684537adf53 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.6 1999/11/11 01:22:26 brianp Exp $ */ +/* $Id: get.c,v 1.7 1999/12/10 20:01:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -35,6 +35,7 @@ #include "extensions.h" #include "get.h" #include "macros.h" +#include "matrix.h" #include "mmath.h" #include "types.h" #include "vb.h" @@ -963,6 +964,42 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_NATIVE_GRAPHICS_HANDLE_PGI: *params = 0; break; + + /* GL_ARB_transpose_matrix */ + case GL_TRANSPOSE_COLOR_MATRIX_ARB: + /* don't have a color matrix */ + break; + case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ModelView.m); + for (i=0;i<16;i++) { + params[i] = FLOAT_TO_BOOL(tm[i]); + } + } + break; + case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ProjectionMatrix.m); + for (i=0;i<16;i++) { + params[i] = FLOAT_TO_BOOL(tm[i]); + } + } + break; + case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->TextureMatrix[texTransformUnit].m); + for (i=0;i<16;i++) { + params[i] = FLOAT_TO_BOOL(tm[i]); + } + } + break; + default: printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); @@ -1878,7 +1915,40 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = 0; break; - + /* GL_ARB_transpose_matrix */ + case GL_TRANSPOSE_COLOR_MATRIX_ARB: + /* don't have a color matrix */ + break; + case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ModelView.m); + for (i=0;i<16;i++) { + params[i] = (GLdouble) tm[i]; + } + } + break; + case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ProjectionMatrix.m); + for (i=0;i<16;i++) { + params[i] = (GLdouble) tm[i]; + } + } + break; + case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->TextureMatrix[texTransformUnit].m); + for (i=0;i<16;i++) { + params[i] = (GLdouble) tm[i]; + } + } + break; default: printf("invalid enum: %x\n", pname); @@ -2791,6 +2861,20 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = 0; break; + /* GL_ARB_transpose_matrix */ + case GL_TRANSPOSE_COLOR_MATRIX_ARB: + /* don't have a color matrix */ + break; + case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: + gl_matrix_transposef(params, ctx->ModelView.m); + break; + case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: + gl_matrix_transposef(params, ctx->ProjectionMatrix.m); + break; + case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: + gl_matrix_transposef(params, ctx->TextureMatrix[texTransformUnit].m); + break; + default: printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); @@ -3717,6 +3801,41 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = ctx->Array.LockCount; break; + /* GL_ARB_transpose_matrix */ + case GL_TRANSPOSE_COLOR_MATRIX_ARB: + /* don't have a color matrix */ + break; + case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ModelView.m); + for (i=0;i<16;i++) { + params[i] = (GLint) tm[i]; + } + } + break; + case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ProjectionMatrix.m); + for (i=0;i<16;i++) { + params[i] = (GLint) tm[i]; + } + } + break; + case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->TextureMatrix[texTransformUnit].m); + for (i=0;i<16;i++) { + params[i] = (GLint) tm[i]; + } + } + break; + default: printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index afd33ed0150..a86c0d3d6fc 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.11 1999/11/24 18:48:31 brianp Exp $ */ +/* $Id: matrix.c,v 1.12 1999/12/10 20:01:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -537,6 +537,50 @@ GLboolean gl_matrix_invert( GLmatrix *mat ) +void gl_matrix_transposef( GLfloat to[16], const GLfloat from[16] ) +{ + to[0] = from[0]; + to[1] = from[4]; + to[2] = from[8]; + to[3] = from[12]; + to[4] = from[1]; + to[5] = from[5]; + to[6] = from[9]; + to[7] = from[13]; + to[8] = from[2]; + to[9] = from[6]; + to[10] = from[10]; + to[11] = from[14]; + to[12] = from[3]; + to[13] = from[7]; + to[14] = from[11]; + to[15] = from[15]; +} + + + +void gl_matrix_transposed( GLdouble to[16], const GLdouble from[16] ) +{ + to[0] = from[0]; + to[1] = from[4]; + to[2] = from[8]; + to[3] = from[12]; + to[4] = from[1]; + to[5] = from[5]; + to[6] = from[9]; + to[7] = from[13]; + to[8] = from[2]; + to[9] = from[6]; + to[10] = from[10]; + to[11] = from[14]; + to[12] = from[3]; + to[13] = from[7]; + to[14] = from[11]; + to[15] = from[15]; +} + + + /* * Generate a 4x4 transformation matrix from glRotate parameters. */ @@ -1331,6 +1375,42 @@ _mesa_Translated( GLdouble x, GLdouble y, GLdouble z ) +void +_mesa_LoadTransposeMatrixfARB( const GLfloat *m ) +{ + GLfloat tm[16]; + gl_matrix_transposef(tm, m); + _mesa_LoadMatrixf(tm); +} + + +void +_mesa_LoadTransposeMatrixdARB( const GLdouble *m ) +{ + GLdouble tm[16]; + gl_matrix_transposed(tm, m); + _mesa_LoadMatrixd(tm); +} + + +void +_mesa_MultTransposeMatrixfARB( const GLfloat *m ) +{ + GLfloat tm[16]; + gl_matrix_transposef(tm, m); + _mesa_MultMatrixf(tm); +} + + +void +_mesa_MultTransposeMatrixdARB( const GLdouble *m ) +{ + GLdouble tm[16]; + gl_matrix_transposed(tm, m); + _mesa_MultMatrixd(tm); +} + + /* * Called via glViewport or display list execution. */ diff --git a/src/mesa/main/matrix.h b/src/mesa/main/matrix.h index e8c79e2c595..d0fcdabb627 100644 --- a/src/mesa/main/matrix.h +++ b/src/mesa/main/matrix.h @@ -1,4 +1,4 @@ -/* $Id: matrix.h,v 1.4 1999/11/12 18:10:47 brianp Exp $ */ +/* $Id: matrix.h,v 1.5 1999/12/10 20:01:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -46,6 +46,11 @@ typedef struct { #endif +extern void gl_matrix_transposef( GLfloat to[16], const GLfloat from[16] ); + +extern void gl_matrix_transposed( GLdouble to[16], const GLdouble from[16] ); + + extern void gl_rotation_matrix( GLfloat angle, GLfloat x, GLfloat y, GLfloat z, GLfloat m[] ); @@ -56,14 +61,14 @@ extern void gl_mat_mul_mat( GLmatrix *mat, const GLmatrix *mat2 ); extern void gl_calculate_model_project_matrix( GLcontext *ctx ); +extern void gl_matrix_copy( GLmatrix *to, const GLmatrix *from ); + extern void gl_matrix_ctr( GLmatrix *m ); extern void gl_matrix_dtr( GLmatrix *m ); extern void gl_matrix_alloc_inv( GLmatrix *m ); -extern void gl_matrix_copy( GLmatrix *to, const GLmatrix *from ); - extern void gl_matrix_mul( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b ); @@ -129,6 +134,18 @@ extern void _mesa_Translated( GLdouble x, GLdouble y, GLdouble z ); extern void +_mesa_LoadTransposeMatrixfARB( const GLfloat *m ); + +extern void +_mesa_LoadTransposeMatrixdARB( const GLdouble *m ); + +extern void +_mesa_MultTransposeMatrixfARB( const GLfloat *m ); + +extern void +_mesa_MultTransposeMatrixdARB( const GLdouble *m ); + +extern void _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ); extern void |