X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fvbo%2Fvbo_exec_array.c;h=bd2fccdba1456fb5a8b79f48d26cb8c9e5b84718;hb=43867acb6afc7fad26cdc2f22b2a3bb6eeefb2da;hp=fd70b57b72edb67d97762169dd344859af83f5fe;hpb=1f196b786d6bd0c6a5dbdc638574ff716cc3d4de;p=mesa.git diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index fd70b57b72e..bd2fccdba14 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -35,7 +35,6 @@ #include "main/bufferobj.h" #include "main/enums.h" #include "main/macros.h" -#include "glapi/dispatch.h" #include "vbo_context.h" @@ -146,7 +145,7 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array, array->Ptr, array->BufferObj->Name); f[k] = 1.0; /* XXX replace the bad value! */ } - //assert(!IS_INF_OR_NAN(f[k])); + /*assert(!IS_INF_OR_NAN(f[k]));*/ } } break; @@ -689,6 +688,16 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, * or we can read/write out of memory in several different places! */ + /* Catch/fix some potential user errors */ + if (type == GL_UNSIGNED_BYTE) { + start = MIN2(start, 0xff); + end = MIN2(end, 0xff); + } + else if (type == GL_UNSIGNED_SHORT) { + start = MIN2(start, 0xffff); + end = MIN2(end, 0xffff); + } + if (end >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ warnCount++; @@ -739,6 +748,10 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, */ } #endif + + /* Set 'end' to the max possible legal value */ + assert(ctx->Array.ArrayObj->_MaxElement >= 1); + end = ctx->Array.ArrayObj->_MaxElement - 1; } else if (0) { _mesa_printf("glDraw[Range]Elements{,BaseVertex}"