summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.h
diff options
context:
space:
mode:
authorFredrik Höglund <[email protected]>2013-04-04 19:55:50 +0200
committerFredrik Höglund <[email protected]>2013-11-07 16:20:45 +0100
commit965900e8305d3a3b966c97ad37699cb73ba3e4f1 (patch)
tree6e6a858834d933d27b49afe1fecf69fb58aefcbc /src/mesa/main/varray.h
parentfb370f89dbebe4be989d994719449507d523f2c6 (diff)
mesa: Handle zero-stride arrays in _mesa_update_array_max_element()
Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
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;