mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
vbo: clamp DrawElements start/end to max possible values
Some apps are sloppy with their start/end values. Clamp them to max possible values to prevent problems later.
This commit is contained in:
parent
af1e9403e7
commit
645e297a00
1 changed files with 10 additions and 0 deletions
|
|
@ -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++;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue