diff options
author | Brian Paul <brianp@vmware.com> | 2010-01-26 13:23:25 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-01-26 13:25:53 -0700 |
commit | 43867acb6afc7fad26cdc2f22b2a3bb6eeefb2da (patch) | |
tree | 4fdb4589a9820b78e79c5192778ed81f9e04855c /src/mesa/vbo/vbo_exec_array.c | |
parent | 06d228d8b92b7f4031f0596d498c24c4ed952e68 (diff) | |
parent | 68ca19afd7299fa9c686f95d53b7e14df37aba4c (diff) |
Merge branch 'mesa_7_7_branch'
Merging was easier than cherry picking in this instance.
Diffstat (limited to 'src/mesa/vbo/vbo_exec_array.c')
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 2c82f7c9c5..bd2fccdba1 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -688,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++; @@ -738,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}" |