From a06575aed66b818253bc79dcca3d6e19c92e4bba Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Feb 2010 12:26:02 -0700 Subject: mesa: use Elements() as limit in loops over texture/program matrix stacks --- src/mesa/main/matrix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/main/matrix.c') diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index ebc3cbd59c3..5c863f6f32a 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -726,10 +726,10 @@ void _mesa_init_matrix( GLcontext * ctx ) _NEW_PROJECTION); init_matrix_stack(&ctx->ColorMatrixStack, MAX_COLOR_STACK_DEPTH, _NEW_COLOR_MATRIX); - for (i = 0; i < MAX_TEXTURE_UNITS; i++) + for (i = 0; i < Elements(ctx->TextureMatrixStack); i++) init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH, _NEW_TEXTURE_MATRIX); - for (i = 0; i < MAX_PROGRAM_MATRICES; i++) + for (i = 0; i < Elements(ctx->ProgramMatrixStack); i++) init_matrix_stack(&ctx->ProgramMatrixStack[i], MAX_PROGRAM_MATRIX_STACK_DEPTH, _NEW_TRACK_MATRIX); ctx->CurrentStack = &ctx->ModelviewMatrixStack; @@ -754,9 +754,9 @@ void _mesa_free_matrix_data( GLcontext *ctx ) free_matrix_stack(&ctx->ModelviewMatrixStack); free_matrix_stack(&ctx->ProjectionMatrixStack); free_matrix_stack(&ctx->ColorMatrixStack); - for (i = 0; i < MAX_TEXTURE_UNITS; i++) + for (i = 0; i < Elements(ctx->TextureMatrixStack); i++) free_matrix_stack(&ctx->TextureMatrixStack[i]); - for (i = 0; i < MAX_PROGRAM_MATRICES; i++) + for (i = 0; i < Elements(ctx->ProgramMatrixStack); i++) free_matrix_stack(&ctx->ProgramMatrixStack[i]); /* combined Modelview*Projection matrix */ _math_matrix_dtr( &ctx->_ModelProjectMatrix ); -- cgit v1.2.3