/*
* 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"),
#include "matrix.h"
#include "mtypes.h"
#include "math/m_matrix.h"
-#include "math/m_xform.h"
/**
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:
_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)
_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)
/**
- * 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.
return;
}
- /* clamp width, and height to implementation dependent range */
- width = CLAMP( width, 1, ctx->Const.MaxViewportWidth );
- height = CLAMP( height, 1, ctx->Const.MaxViewportHeight );
+ /* clamp width and height to the implementation dependent range */
+ width = CLAMP(width, 1, (GLsizei) ctx->Const.MaxViewportWidth);
+ height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight);
- /* Save viewport */
ctx->Viewport.X = x;
ctx->Viewport.Width = width;
ctx->Viewport.Y = y;
ctx->Viewport.Height = height;
-
ctx->NewState |= _NEW_VIEWPORT;
+#if 1
+ /* XXX remove this someday. Currently the DRI drivers rely on
+ * the WindowMap matrix being up to date in the driver's Viewport
+ * and DepthRange functions.
+ */
+ _math_matrix_viewport(&ctx->Viewport._WindowMap,
+ ctx->Viewport.X, ctx->Viewport.Y,
+ ctx->Viewport.Width, ctx->Viewport.Height,
+ ctx->Viewport.Near, ctx->Viewport.Far,
+ ctx->DrawBuffer->_DepthMaxF);
+#endif
+
if (ctx->Driver.Viewport) {
/* Many drivers will use this call to check for window size changes
* and reallocate the z/stencil/accum/etc buffers if needed.
#if _HAVE_FULL_GL
-void GLAPIENTRY
/**
* Called by glDepthRange
*
* \param farval specifies the Z buffer value which should correspond to
* the far clip plane
*/
+void GLAPIENTRY
_mesa_DepthRange( GLclampd nearval, GLclampd farval )
{
GET_CURRENT_CONTEXT(ctx);
ctx->Viewport.Far = (GLfloat) CLAMP( farval, 0.0, 1.0 );
ctx->NewState |= _NEW_VIEWPORT;
+#if 1
+ /* XXX remove this someday. Currently the DRI drivers rely on
+ * the WindowMap matrix being up to date in the driver's Viewport
+ * and DepthRange functions.
+ */
+ _math_matrix_viewport(&ctx->Viewport._WindowMap,
+ ctx->Viewport.X, ctx->Viewport.Y,
+ ctx->Viewport.Width, ctx->Viewport.Height,
+ ctx->Viewport.Near, ctx->Viewport.Far,
+ ctx->DrawBuffer->_DepthMaxF);
+#endif
+
if (ctx->Driver.DepthRange) {
(*ctx->Driver.DepthRange)( ctx, nearval, farval );
}
* 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;
* 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++) {