From: Fredrik Höglund Date: Thu, 4 Apr 2013 17:55:50 +0000 (+0200) Subject: mesa: Handle zero-stride arrays in _mesa_update_array_max_element() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=965900e8305d3a3b966c97ad37699cb73ba3e4f1;p=mesa.git mesa: Handle zero-stride arrays in _mesa_update_array_max_element() Reviewed-by: Eric Anholt Reviewed-by: Ian Romanick --- diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index a75cb7db8ea..8a9487c6e6c 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -51,8 +51,10 @@ _mesa_update_array_max_element(struct gl_client_array *array) GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size; if (offset < bufSize) { - array->_MaxElement = (bufSize - offset + array->StrideB - - array->_ElementSize) / array->StrideB; + const GLuint stride = array->StrideB ? + array->StrideB : array->_ElementSize; + array->_MaxElement = (bufSize - offset + stride + - array->_ElementSize) / stride; } else { array->_MaxElement = 0;