[Mesa-dev] [PATCH 08/11] mesa: Handle zero-stride arrays in _mesa_update_array_max_element()
Fredrik Höglund
fredrik at kde.org
Tue Nov 5 14:50:54 PST 2013
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/main/varray.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index a75cb7d..8a9487c 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;
--
1.7.10.4
More information about the mesa-dev
mailing list