aboutsummaryrefslogtreecommitdiff
path: root/src/library_gl.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-17 21:08:28 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-17 21:08:57 -0700
commit040eb9db4222bf3b3eff2ba0ca72e83830f76d47 (patch)
tree22e296a371e08ffe94af30b3818cfe7f10eec8ce /src/library_gl.js
parent437849e6571f156225a14273a403f0a0750d7857 (diff)
when we have multiple strides, restride
Diffstat (limited to 'src/library_gl.js')
-rw-r--r--src/library_gl.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 0912b5da..b91d782c 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -2282,14 +2282,14 @@ var LibraryGL = {
}
attributes.sort(function(x, y) { return !x ? (!y ? 0 : 1) : (!y ? -1 : (x.pointer - y.pointer)) });
start = GL.currArrayBuffer ? 0 : attributes[0].pointer;
+ var multiStrides = false;
for (var i = 0; i < attributes.length; i++) {
var attribute = attributes[i];
if (!attribute) break;
-#if ASSERTIONS
- assert(stride == 0 || stride == attribute.stride); // must all be in the same buffer
-#endif
+ if (stride != 0 && stride != attribute.stride) multiStrides = true;
if (attribute.stride) stride = attribute.stride;
}
+ if (multiStrides) stride = 0; // we will need to restride
var bytes = 0; // total size in bytes
if (!stride && !beginEnd) {
// beginEnd can not have stride in the attributes, that is fine. otherwise,
@@ -2297,7 +2297,7 @@ var LibraryGL = {
// our emulation code simple, we perform unpacking/restriding here. this adds overhead, so
// it is a good idea to not hit this!
#if ASSERTIONS
- Runtime.warnOnce('Unpacking/restriding attributes, this is not fast');
+ Runtime.warnOnce('Unpacking/restriding attributes, this is slow and dangerous');
#endif
if (!GL.immediate.restrideBuffer) GL.immediate.restrideBuffer = _malloc(GL.MAX_TEMP_BUFFER_SIZE);
start = GL.immediate.restrideBuffer;