summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/dispatch.c10
-rw-r--r--src/mesa/main/dlist.c43
-rw-r--r--src/mesa/main/extensions.c3
-rw-r--r--src/mesa/main/get.c123
-rw-r--r--src/mesa/main/matrix.c82
-rw-r--r--src/mesa/main/matrix.h23
6 files changed, 275 insertions, 9 deletions
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