summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/varray.h')
-rw-r--r--src/mesa/main/varray.h6
1 files changed, 4 insertions, 2 deletions
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;