diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-02-06 14:54:51 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-02-06 14:54:51 -0800 |
commit | 3360757e086753077696d96d06fc1c5edb44d175 (patch) | |
tree | 807f7c104506845b3fcb55178419d7c4cf8c0fc7 | |
parent | a34e8338aa0d385cc0bcd05e4047db79752b67f7 (diff) |
better checks for stride in prepareClientAttributes
-rw-r--r-- | src/library_gl.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index 5c64e5f6..5102dd0d 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -1997,6 +1997,7 @@ var LibraryGL = { #endif if (attribute.stride) stride = attribute.stride; } + assert(stride || beginEnd); // beginEnd can not have stride in the attributes, that is fine var bytes = 0; for (var i = 0; i < attributes.length; i++) { @@ -2010,7 +2011,7 @@ var LibraryGL = { bytes += attribute.size * GL.immediate.byteSizeByType[attribute.type - GL.immediate.byteSizeByTypeRoot]; if (bytes % 4 != 0) bytes += 4 - (bytes % 4); // XXX assuming 4-alignment } - assert(stride == 0 || bytes <= stride); + assert(beginEnd || bytes <= stride); // if not begin-end, explicit stride should make sense with total byte size if (bytes < stride) { // ensure the size is that of the stride bytes = stride; } |