From a2b9bad251b058f6255fa037b842c5465c0609a2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 10 Nov 2003 19:08:37 +0000 Subject: Redo array element checking for vertex array buffers. Now, compute ctx->Array._MaxElement as the min of enabled array's max element. Test against ctx->Array._MaxElement in glDrawArrays/Elements. Note: testing in glArrayElement not done yet. Only do element checking if ctx->Const.CheckArrayBounds is set. --- src/mesa/main/context.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mesa/main/context.c') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 51abf86072..f524045532 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1062,6 +1062,15 @@ _mesa_init_constants( GLcontext *ctx ) ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; + /* If we're running in the X server, do bounds checking to prevent + * segfaults and server crashes! + */ +#if defined(XFree86LOADER) && defined(IN_MODULE) + ctx->Const.CheckArrayBounds = GL_TRUE; +#else + ctx->Const.CheckArrayBounds = GL_FALSE; +#endif + ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); } -- cgit v1.2.3