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 378934 e40d0d6bd40d1259aa266c96c226a0b88a9f7945
parent 378933 1c47a4f604c6c5cd4e2e1fe59c57a29d492154b0
child 378935 3d2d1c251cc80f8288cc7b320703e55c37a606fd
push id21011
push usermak77@bonardo.net
push dateThu, 16 Jun 2016 13:40:45 +0000
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());