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 324486 e40d0d6bd40d1259aa266c96c226a0b88a9f7945
parent 324485 1c47a4f604c6c5cd4e2e1fe59c57a29d492154b0
child 324487 3d2d1c251cc80f8288cc7b320703e55c37a606fd
push id6031
push userkwierso@gmail.com
push dateThu, 26 May 2016 18:23:42 +0000
treeherdermozilla-beta@417e1ec42d8f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, ritu
bugs1248580
milestone47.0
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());