From 5498e8b9f34718aba506421988116ccb1e5e3de7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 13 Mar 2004 16:32:58 +0000 Subject: [PATCH] more descriptive error messages for matrix stack over/underflows --- src/mesa/main/matrix.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 76ca28451f7..8204c258a63 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -10,9 +10,9 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 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"), @@ -234,7 +234,15 @@ _mesa_PushMatrix( void ) _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); if (stack->Depth + 1 >= stack->MaxDepth) { - _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix" ); + if (ctx->Transform.MatrixMode == GL_TEXTURE) { + _mesa_error(ctx, GL_STACK_OVERFLOW, + "glPushMatrix(mode=GL_TEXTURE, unit=%d)", + ctx->Texture.CurrentUnit); + } + else { + _mesa_error(ctx, GL_STACK_OVERFLOW, "glPushMatrix(mode=%s)", + _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); + } return; } _math_matrix_copy( &stack->Stack[stack->Depth + 1], @@ -266,7 +274,15 @@ _mesa_PopMatrix( void ) _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); if (stack->Depth == 0) { - _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix" ); + if (ctx->Transform.MatrixMode == GL_TEXTURE) { + _mesa_error(ctx, GL_STACK_UNDERFLOW, + "glPopMatrix(mode=GL_TEXTURE, unit=%d)", + ctx->Texture.CurrentUnit); + } + else { + _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopMatrix(mode=%s)", + _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); + } return; } stack->Depth--; -- 2.30.2