Bug 1248580 - handle gl.UniformMatrixXfv() function uploading element size. r=jgilbert a=ritu
authorJerryShih <hshih@mozilla.com>
Wed, 25 May 2016 16:28:00 +0200
changeset 335034 7a77ab4d41c7d15cf7cf868f750cbef06ddc1fb3
parent 335033 ccd86521d8457aa09673b22b85f2d4f2c6e1feca
child 335035 abce57bf965ba789f1ae52cf5865d60177132385
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, ritu
bugs1248580
milestone48.0a2
Bug 1248580 - handle gl.UniformMatrixXfv() function uploading element size. r=jgilbert a=ritu
dom/canvas/WebGLContextValidate.cpp
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -525,19 +525,21 @@ WebGLContext::ValidateUniformMatrixArray
         return false;
 
     if (!loc->ValidateArrayLength(setterElemSize, setterArraySize, this, funcName))
         return false;
 
     if (!ValidateUniformMatrixTranspose(setterTranspose, funcName))
         return false;
 
+    MOZ_ASSERT((size_t)loc->mActiveInfo->mElemCount > loc->mArrayIndex);
+    size_t uniformElemCount = loc->mActiveInfo->mElemCount - loc->mArrayIndex;
     *out_rawLoc = loc->mLoc;
-    *out_numElementsToUpload = std::min((size_t)loc->mActiveInfo->mElemCount,
-                                        setterArraySize / setterElemSize);
+    *out_numElementsToUpload = std::min(uniformElemCount, setterArraySize / setterElemSize);
+
     return true;
 }
 
 bool
 WebGLContext::ValidateAttribIndex(GLuint index, const char* info)
 {
     bool valid = (index < MaxVertexAttribs());