summaryrefslogtreecommitdiff
path: root/src/mesa/main/matrix.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-04-18 18:02:43 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-04-18 18:02:43 +0000
commitedd677454dc38a590bd6fc1cd3e2759d2a4d55e3 (patch)
tree52a93e5ef93d23971cb4dfc994a347b1b6bafd1c /src/mesa/main/matrix.c
parent9b14e0fbfd96d02574f8f5910ebc8a52c62a24aa (diff)
minor re-org of program matrix, program local parameter limits
Diffstat (limited to 'src/mesa/main/matrix.c')
-rw-r--r--src/mesa/main/matrix.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index af046a3c8f..83d2ff425e 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -1,5 +1,3 @@
-/* $Id: matrix.c,v 1.46 2003/03/01 01:50:21 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -132,14 +130,39 @@ _mesa_MatrixMode( GLenum mode )
case GL_MATRIX5_NV:
case GL_MATRIX6_NV:
case GL_MATRIX7_NV:
- if (!ctx->Extensions.NV_vertex_program) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode" );
+ if (ctx->Extensions.NV_vertex_program) {
+ ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
+ return;
+ }
+ break;
+ case GL_MATRIX0_ARB:
+ case GL_MATRIX1_ARB:
+ case GL_MATRIX2_ARB:
+ case GL_MATRIX3_ARB:
+ case GL_MATRIX4_ARB:
+ case GL_MATRIX5_ARB:
+ case GL_MATRIX6_ARB:
+ case GL_MATRIX7_ARB:
+ if (ctx->Extensions.ARB_vertex_program ||
+ ctx->Extensions.ARB_fragment_program) {
+ const GLint m = mode - GL_MATRIX0_ARB;
+ if (m > ctx->Const.MaxProgramMatrices) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glMatrixMode(GL_MATRIX%d_ARB)", m);
+ return;
+ }
+ ctx->CurrentStack = &ctx->ProgramMatrixStack[m];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
return;
}
- ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV];
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" );
return;
}