mesa: don't include m_xform.h where not needed
[mesa.git] / src / mesa / main / matrix.c
index ecd3732c933107a178e38a258e129dcf0feadb58..90d142278d183f85c1c006a23ea3b09b87ac0615 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.3
+ * Version:  6.5.3
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -42,7 +42,6 @@
 #include "matrix.h"
 #include "mtypes.h"
 #include "math/m_matrix.h"
-#include "math/m_xform.h"
 
 
 /**
@@ -160,6 +159,10 @@ _mesa_MatrixMode( GLenum mode )
       ctx->CurrentStack = &ctx->ProjectionMatrixStack;
       break;
    case GL_TEXTURE:
+      if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+         _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(texcoord unit)");
+         return;
+      }
       ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit];
       break;
    case GL_COLOR:
@@ -226,7 +229,7 @@ void GLAPIENTRY
 _mesa_PushMatrix( void )
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct matrix_stack *stack = ctx->CurrentStack;
+   struct gl_matrix_stack *stack = ctx->CurrentStack;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    if (MESA_VERBOSE&VERBOSE_API)
@@ -266,7 +269,7 @@ void GLAPIENTRY
 _mesa_PopMatrix( void )
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct matrix_stack *stack = ctx->CurrentStack;
+   struct gl_matrix_stack *stack = ctx->CurrentStack;
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    if (MESA_VERBOSE&VERBOSE_API)
@@ -423,7 +426,7 @@ _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
 
 
 /**
- * Multiply the current matrix with a general scaling matrix.
+ * Multiply the current matrix with a translation matrix.
  *
  * \param x translation vector x coordinate.
  * \param y translation vector y coordinate.
@@ -576,8 +579,8 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
    }
 
    /* clamp width and height to the implementation dependent range */
-   width  = CLAMP(width,  1, ctx->Const.MaxViewportWidth);
-   height = CLAMP(height, 1, ctx->Const.MaxViewportHeight);
+   width  = CLAMP(width,  1, (GLsizei) ctx->Const.MaxViewportWidth);
+   height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight);
 
    ctx->Viewport.X = x;
    ctx->Viewport.Width = width;
@@ -762,7 +765,7 @@ void _mesa_update_modelview_project( GLcontext *ctx, GLuint new_state )
  * initialize it.
  */
 static void
-init_matrix_stack( struct matrix_stack *stack,
+init_matrix_stack( struct gl_matrix_stack *stack,
                    GLuint maxDepth, GLuint dirtyFlag )
 {
    GLuint i;
@@ -788,7 +791,7 @@ init_matrix_stack( struct matrix_stack *stack,
  * frees the array.
  */
 static void
-free_matrix_stack( struct matrix_stack *stack )
+free_matrix_stack( struct gl_matrix_stack *stack )
 {
    GLuint i;
    for (i = 0; i < stack->MaxDepth; i++) {